Bug 1344281 - Don't accidentally require config.status when running |./mach try|. r=nalexander
MozReview-Commit-ID: Ez8GI46kv7z
--- a/testing/mach_commands.py
+++ b/testing/mach_commands.py
@@ -13,17 +13,17 @@ import shutil
from collections import defaultdict
from mach.decorators import (
CommandArgument,
CommandProvider,
Command,
)
-from mozbuild.base import MachCommandBase
+from mozbuild.base import BuildEnvironmentNotFoundException, MachCommandBase
from mozbuild.base import MachCommandConditions as conditions
import mozpack.path as mozpath
from argparse import ArgumentParser
UNKNOWN_TEST = '''
I was unable to find tests from the given argument(s).
You should specify a test directory, filename, test suite name, or
@@ -685,32 +685,42 @@ class PushToTry(MachCommandBase):
paths)
sys.exit(1)
if not kwargs["intersection"]:
paths_by_flavor = at.remove_duplicates(paths_by_flavor, tests)
else:
paths_by_flavor = {}
+ local_artifact_build = False
+ try:
+ if self.substs.get("MOZ_ARTIFACT_BUILDS"):
+ local_artifact_build = True
+ except BuildEnvironmentNotFoundException:
+ # If we don't have a build locally, we can't tell whether
+ # an artifact build is desired, but we still want the
+ # command to succeed, if possible.
+ pass
+
# Add --artifact if --enable-artifact-builds is set ...
- if self.substs.get("MOZ_ARTIFACT_BUILDS"):
+ if local_artifact_build:
extra["artifact"] = True
# ... unless --no-artifact is explicitly given.
if kwargs["no_artifact"]:
if "artifact" in extra:
del extra["artifact"]
try:
msg = at.calc_try_syntax(platforms, tests, talos, builds, paths_by_flavor, tags,
extra, kwargs["intersection"])
except ValueError as e:
print(e.message)
sys.exit(1)
- if self.substs.get("MOZ_ARTIFACT_BUILDS"):
+ if local_artifact_build:
if kwargs["no_artifact"]:
print('mozconfig has --enable-artifact-builds but '
'--no-artifact specified, not including --artifact '
'flag in try syntax')
else:
print('mozconfig has --enable-artifact-builds; including '
'--artifact flag in try syntax (use --no-artifact '
'to override)')