Bug 1256571 - Delay resolving the reason for an implied option. r?chmanchester
--- 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)