mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-29 02:17:45 -10:00
Bug 1555824 - Don't call MozbuildObject.substs from a MachCommandCondition r=nalexander
Invoking MozbuildObject.substs causes an exception to be raised if there is no BuildEnvironment. This means that we hit an error on |mach help| if there is no build, which is not ideal for people trying to learn how to build :). Differential Revision: https://phabricator.services.mozilla.com/D33217
This commit is contained in:
1 parent
3e472f1004
commit
12596513b3
1 file changed
+16
-4
@@ -23,6 +23,8 @@ from mach.mixin.process import ProcessExecutionMixin
|
||||
from mozversioncontrol import (
|
||||
get_repository_from_build_config,
|
||||
get_repository_object,
|
||||
GitRepository,
|
||||
HgRepository,
|
||||
InvalidRepoPath,
|
||||
)
|
||||
|
||||
@@ -992,22 +994,32 @@ class MachCommandConditions(object):
|
||||
@staticmethod
|
||||
def is_hg(cls):
|
||||
"""Must have a mercurial source checkout."""
|
||||
return getattr(cls, 'substs', {}).get('VCS_CHECKOUT_TYPE') == 'hg'
|
||||
try:
|
||||
return isinstance(cls.repository, HgRepository)
|
||||
except InvalidRepoPath:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def is_git(cls):
|
||||
"""Must have a git source checkout."""
|
||||
return getattr(cls, 'substs', {}).get('VCS_CHECKOUT_TYPE') == 'git'
|
||||
try:
|
||||
return isinstance(cls.repository, GitRepository)
|
||||
except InvalidRepoPath:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def is_artifact_build(cls):
|
||||
"""Must be an artifact build."""
|
||||
return getattr(cls, 'substs', {}).get('MOZ_ARTIFACT_BUILDS')
|
||||
if hasattr(cls, 'substs'):
|
||||
return getattr(cls, 'substs', {}).get('MOZ_ARTIFACT_BUILDS')
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def is_non_artifact_build(cls):
|
||||
"""Must not be an artifact build."""
|
||||
return not MachCommandConditions.is_artifact_build(cls)
|
||||
if hasattr(cls, 'substs'):
|
||||
return not MachCommandConditions.is_artifact_build(cls)
|
||||
return False
|
||||
|
||||
|
||||
class PathArgument(object):
|
||||
|
||||
Reference in new issue
Block a user