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,
mozconfig=mozconfig)
- @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))
@property
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
@property
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,
config_topobjdir):
raise ObjdirMismatchException(topobjdir, config_topobjdir)
except BuildEnvironmentNotFoundException:
pass
except ObjdirMismatchException as e:
print('Ambiguous object directory detected. We detected that '
'both %s and %s could be object directories. This is '