Bug 1256571 - Delay resolving the reason for an implied option. r?chmanchester draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 08 Apr 2016 15:57:33 +0900
changeset 350225 25d6b9100b0752b10477addde4ff7a171f16cfd7
parent 350224 44e7ae522bf13c8b5a73209109a35f16e39e86b2
child 350226 0c969f8cf1364ddbf489b7a05154a11fc649e1aa
push id15274
push userbmo:mh+mozilla@glandium.org
push dateWed, 13 Apr 2016 01:01:28 +0000
reviewerschmanchester
bugs1256571
milestone48.0a1
Bug 1256571 - Delay resolving the reason for an implied option. r?chmanchester
python/mozbuild/mozbuild/configure/__init__.py
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -292,16 +292,17 @@ class ConfigureSandbox(dict):
             self._options[option.name] = option
         if option.env:
             self._options[option.env] = option
 
         try:
             value, option_string = self._helper.handle(option)
         except ConflictingOptionError as e:
             frameinfo, reason = self._implied_options[e.arg]
+            reason = self._raw_options.get(reason) or reason.option
             raise InvalidOptionError(
                 "'%s' implied by '%s' conflicts with '%s' from the %s"
                 % (e.arg, reason, e.old_arg, e.old_origin))
 
         if self._help:
             self._help.add(option)
 
         self._option_values[option] = value
@@ -586,18 +587,17 @@ class ConfigureSandbox(dict):
         # Don't do anything when --help was on the command line
         if self._help:
             return
         if not reason and isinstance(value, DependsFunction):
             deps = self._depends[value][1]
             possible_reasons = [d for d in deps if d != self._help_option]
             if len(possible_reasons) == 1:
                 if isinstance(possible_reasons[0], Option):
-                    reason = (self._raw_options.get(possible_reasons[0]) or
-                              possible_reasons[0].option)
+                    reason = possible_reasons[0]
 
         if not reason:
             raise ConfigureError(
                 "Cannot infer what implies '%s'. Please add a `reason` to "
                 "the `imply_option` call."
                 % option)
 
         value = self._resolve(value, need_help_dependency=False)