Bug 1282256 - Make MozbuildObject.resolve_mozconfig_topobjdir an instance method. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 04 Aug 2016 13:41:57 +0900
changeset 308519 58bdfaad94aa02d08220e4a218cc4bb6f695e3e4
parent 308518 fbeb48318c1e6616a2d2fad4155f76af61f5daf3
child 308520 61a4dd746681fe7c56e1802fc80fe58caf426869
push id31128
push usermh@glandium.org
push dateMon, 08 Aug 2016 01:21:26 +0000
treeherderautoland@61a4dd746681 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1282256 - Make MozbuildObject.resolve_mozconfig_topobjdir an instance method. r=gps The only use that didn't have an existing instance was just removed.
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -167,36 +167,36 @@ class MozbuildObject(ProcessExecutionMix
                     '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,
-    @staticmethod
-    def resolve_mozconfig_topobjdir(topsrcdir, mozconfig, default=None):
-        topobjdir = mozconfig['topobjdir'] or default
+    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@',
-                MozbuildObject.resolve_config_guess(mozconfig, topsrcdir))
+                MozbuildObject.resolve_config_guess(self.mozconfig,
+                                                    self.topsrcdir))
         if not os.path.isabs(topobjdir):
-            topobjdir = os.path.abspath(os.path.join(topsrcdir, topobjdir))
+            topobjdir = os.path.abspath(os.path.join(self.topsrcdir, topobjdir))
         return mozpath.normsep(os.path.normpath(topobjdir))
     def topobjdir(self):
         if self._topobjdir is None:
-            self._topobjdir = MozbuildObject.resolve_mozconfig_topobjdir(
-                self.topsrcdir, self.mozconfig, default='obj-@CONFIG_GUESS@')
+            self._topobjdir = self.resolve_mozconfig_topobjdir(
+                default='obj-@CONFIG_GUESS@')
         return self._topobjdir
     def virtualenv_manager(self):
         if self._virtualenv_manager is None:
             self._virtualenv_manager = VirtualenvManager(self.topsrcdir,
                 self.topobjdir, os.path.join(self.topobjdir, '_virtualenv'),
@@ -666,18 +666,17 @@ class MachCommandBase(MozbuildObject):
             topsrcdir = dummy.topsrcdir
             topobjdir = dummy._topobjdir
             if topobjdir:
                 # If we're inside a objdir and the found mozconfig resolves to
                 # another objdir, we abort. The reasoning here is that if you
                 # are inside an objdir you probably want to perform actions on
                 # that objdir, not another one. This prevents accidental usage
                 # of the wrong objdir when the current objdir is ambiguous.
-                config_topobjdir = MozbuildObject.resolve_mozconfig_topobjdir(
-                    topsrcdir, dummy.mozconfig)
+                config_topobjdir = dummy.resolve_mozconfig_topobjdir()
                 if config_topobjdir and not samepath(topobjdir,
                     raise ObjdirMismatchException(topobjdir, config_topobjdir)
         except BuildEnvironmentNotFoundException:
         except ObjdirMismatchException as e:
             print('Ambiguous object directory detected. We detected that '
                 'both %s and %s could be object directories. This is '