Bug 1411462 - Normalize when argument earlier in imply_option(); r?glandium draft
authorGregory Szorc <gps@mozilla.com>
Tue, 24 Oct 2017 12:56:10 -0700
changeset 696034 5923f383ba014d75db1fa70aa76073465b03f68e
parent 695940 ed94dc665071d8d510688ff50bbedad2c7cb33ee
child 696035 461c9b31684c4cf935c339cb7ccb95872d4fe343
push id88618
push userbmo:gps@mozilla.com
push dateFri, 10 Nov 2017 04:44:25 +0000
reviewersglandium
bugs1411462, 1405982
milestone58.0a1
Bug 1411462 - Normalize when argument earlier in imply_option(); r?glandium This makes `configure --help` work again (it stopped working due to 370a4a2a7898 (bug 1405982). MozReview-Commit-ID: 2gCmAAsE0qW
python/mozbuild/mozbuild/configure/__init__.py
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -904,16 +904,19 @@ class ConfigureSandbox(dict):
 
         The `value` argument can also be (and usually is) a reference to a
         @depends function, in which case the result of that function will be
         used as per the descripted mapping above.
 
         The `reason` argument indicates what caused the option to be implied.
         It is necessary when it cannot be inferred from the `value`.
         '''
+
+        when = self._normalize_when(when, 'imply_option')
+
         # Don't do anything when --help was on the command line
         if self._help:
             return
         if not reason and isinstance(value, SandboxDependsFunction):
             deps = self._depends[value].dependencies
             possible_reasons = [d for d in deps if d != self._help_option]
             if len(possible_reasons) == 1:
                 if isinstance(possible_reasons[0], Option):
@@ -926,18 +929,16 @@ class ConfigureSandbox(dict):
             reason = "imply_option at %s:%s" % (filename, line)
 
         if not reason:
             raise ConfigureError(
                 "Cannot infer what implies '%s'. Please add a `reason` to "
                 "the `imply_option` call."
                 % option)
 
-        when = self._normalize_when(when, 'imply_option')
-
         prefix, name, values = Option.split_option(option)
         if values != ():
             raise ConfigureError("Implied option must not contain an '='")
 
         self._implied_options.append(ReadOnlyNamespace(
             option=option,
             prefix=prefix,
             name=name,