зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1632348 - Convert mach artifact to python 3. r=rstewart
Differential Revision: https://phabricator.services.mozilla.com/D72114
This commit is contained in:
Родитель
340788143e
Коммит
568944c117
1
mach
1
mach
|
@ -14,7 +14,6 @@ py2commands="
|
|||
analyze
|
||||
android
|
||||
android-emulator
|
||||
artifact
|
||||
awsy-test
|
||||
browsertime
|
||||
cargo
|
||||
|
|
|
@ -705,7 +705,7 @@ def open_manifest(manifest_file):
|
|||
"""I know how to take a filename and load it into a Manifest object"""
|
||||
if os.path.exists(manifest_file):
|
||||
manifest = Manifest()
|
||||
with open(manifest_file, "rb") as f:
|
||||
with open(manifest_file, "r" if PY3 else "rb") as f:
|
||||
manifest.load(f)
|
||||
log.debug("loaded manifest from file '%s'" % manifest_file)
|
||||
return manifest
|
||||
|
|
|
@ -162,7 +162,7 @@ class ArtifactCache(object):
|
|||
if len(fname) not in (32, 40, 56, 64, 96, 128):
|
||||
raise TypeError()
|
||||
binascii.unhexlify(fname)
|
||||
except TypeError:
|
||||
except (TypeError, binascii.Error):
|
||||
# We download to a temporary name like HASH[:16]-basename to
|
||||
# differentiate among URLs with the same basenames. We used to then
|
||||
# extract the build ID from the downloaded artifact and use it to make a
|
||||
|
|
|
@ -412,7 +412,7 @@ class PackageFrontend(MachCommandBase):
|
|||
# Keep a sha256 of each downloaded file, for the chain-of-trust
|
||||
# validation.
|
||||
if artifact_manifest is not None:
|
||||
with open(local) as fh:
|
||||
with open(local, 'rb') as fh:
|
||||
h = hashlib.sha256()
|
||||
while True:
|
||||
data = fh.read(1024 * 1024)
|
||||
|
|
|
@ -897,6 +897,7 @@ class Artifacts(object):
|
|||
env = kwargs.get('env', {})
|
||||
env['HGPLAIN'] = '1'
|
||||
kwargs['env'] = ensure_subprocess_env(env)
|
||||
kwargs['universal_newlines'] = True
|
||||
return subprocess.check_output([self._hg] + list(args),
|
||||
**kwargs)
|
||||
|
||||
|
@ -979,11 +980,11 @@ class Artifacts(object):
|
|||
self._git, 'rev-list', '--topo-order',
|
||||
'--max-count={num}'.format(num=NUM_REVISIONS_TO_QUERY),
|
||||
'HEAD',
|
||||
], cwd=self._topsrcdir)
|
||||
], universal_newlines=True, cwd=self._topsrcdir)
|
||||
|
||||
hg_hash_list = subprocess.check_output([
|
||||
self._git, 'cinnabar', 'git2hg'
|
||||
] + rev_list.splitlines(), cwd=self._topsrcdir)
|
||||
] + rev_list.splitlines(), universal_newlines=True, cwd=self._topsrcdir)
|
||||
|
||||
zeroes = "0" * 40
|
||||
|
||||
|
@ -1201,7 +1202,8 @@ see https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code
|
|||
elif self._git:
|
||||
revset = subprocess.check_output([
|
||||
self._git, 'rev-parse', '%s^{commit}' % revset],
|
||||
stderr=open(os.devnull, 'w'), cwd=self._topsrcdir).strip()
|
||||
stderr=open(os.devnull, 'w'), universal_newlines=True,
|
||||
cwd=self._topsrcdir).strip()
|
||||
else:
|
||||
# Fallback to the exception handling case from both hg and git
|
||||
raise subprocess.CalledProcessError()
|
||||
|
@ -1215,7 +1217,8 @@ see https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code
|
|||
|
||||
if revision is None and self._git:
|
||||
revision = subprocess.check_output(
|
||||
[self._git, 'cinnabar', 'git2hg', revset], cwd=self._topsrcdir).strip()
|
||||
[self._git, 'cinnabar', 'git2hg', revset], universal_newlines=True,
|
||||
cwd=self._topsrcdir).strip()
|
||||
|
||||
if revision == "0" * 40 or revision is None:
|
||||
raise ValueError('revision specification must resolve to a commit known to hg')
|
||||
|
|
Загрузка…
Ссылка в новой задаче