Bug 1282256 - Make MozbuildObject.resolve_mozconfig_topobjdir an instance method. r=gps, a=sledru
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 04 Aug 2016 13:41:57 +0900
changeset 350313 4891b4b3ebb059458cba7360c49cc3529d6c7af1
parent 350312 99b6469ac099191eea1adb31f00c71080248dc94
child 350314 6be9a5c9c8cd25d2082376495b788d85ce3cca98
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps, sledru
Bug 1282256 - Make MozbuildObject.resolve_mozconfig_topobjdir an instance method. r=gps, a=sledru 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 '