Bug 1583353 - [mozbuild] Forward unrecognized kwargs to underlying class in MozbuildObject.from_environment(), r=firefox-build-system-reviewers,mshal
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 31 Oct 2019 18:02:09 +0000
changeset 500224 bca7369cc0d346bc1a3ba57e63ff5832f4d5a218
parent 500223 b989eb460f443844bfe1ab1f2ee00761e92a195b
child 500225 f6d096dd754d0df5490193da0414c747dab13aec
push id36757
push userapavel@mozilla.com
push dateSat, 02 Nov 2019 09:54:21 +0000
treeherdermozilla-central@8aa8ed80ea43 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, mshal
bugs1583353
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1583353 - [mozbuild] Forward unrecognized kwargs to underlying class in MozbuildObject.from_environment(), r=firefox-build-system-reviewers,mshal This allows subclasses of MozbuildObject to define additional instance arguments and still use 'from_environment'. Differential Revision: https://phabricator.services.mozilla.com/D51174
python/mozbuild/mozbuild/base.py
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -104,17 +104,17 @@ class MozbuildObject(ProcessExecutionMix
 
         self._make = None
         self._topobjdir = mozpath.normsep(topobjdir) if topobjdir else topobjdir
         self._mozconfig = mozconfig
         self._config_environment = None
         self._virtualenv_manager = None
 
     @classmethod
-    def from_environment(cls, cwd=None, detect_virtualenv_mozinfo=True):
+    def from_environment(cls, cwd=None, detect_virtualenv_mozinfo=True, **kwargs):
         """Create a MozbuildObject by detecting the proper one from the env.
 
         This examines environment state like the current working directory and
         creates a MozbuildObject from the found source directory, mozconfig, etc.
 
         The role of this function is to identify a topsrcdir, topobjdir, and
         mozconfig file.
 
@@ -181,17 +181,17 @@ class MozbuildObject(ProcessExecutionMix
                 raise BadEnvironmentException(
                     'The object directory appears '
                     'to be the same as your source directory (%s). This build '
                     'configuration is not supported.' % topsrcdir)
 
         # If we can't resolve topobjdir, oh well. We'll figure out when we need
         # one.
         return cls(topsrcdir, None, None, topobjdir=topobjdir,
-                   mozconfig=mozconfig)
+                   mozconfig=mozconfig, **kwargs)
 
     def resolve_mozconfig_topobjdir(self, default=None):
         topobjdir = self.mozconfig['topobjdir'] or default
         if not topobjdir:
             return None
 
         if '@CONFIG_GUESS@' in topobjdir:
             topobjdir = topobjdir.replace('@CONFIG_GUESS@',