Skip to content

Commit

Permalink
Bug 1620744 - Convert fat_aar.py to py3; r=nalexander
Browse files Browse the repository at this point in the history
  • Loading branch information
mshal committed Mar 9, 2020
1 parent 1d4d132 commit 0fa5089
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ endif

ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES
recurse_android-fat-aar-artifact:
$(call py_action,fat_aar,\
$(call py3_action,fat_aar,\
$(addprefix --armeabi-v7a $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_ARMEABI_V7A)) \
$(addprefix --arm64-v8a $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_ARM64_V8A)) \
$(addprefix --x86 $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_X86)) \
Expand Down
9 changes: 5 additions & 4 deletions python/mozbuild/mozbuild/action/fat_aar.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from __future__ import absolute_import, unicode_literals, print_function

import argparse
import six
import sys

from collections import (
Expand Down Expand Up @@ -70,7 +71,7 @@ def fat_aar(distdir, aars_paths, no_process=False, no_compatibility_check=False)
diffs['{}!/{}'.format(path, r)][fingerprint].append(arch)

else:
fingerprint = sha1(fileobj.open().read()).hexdigest()
fingerprint = sha1(six.ensure_binary(fileobj.open().read())).hexdigest()
# There's no need to distinguish `target.maven.zip` from `assets/omni.ja` here,
# since in practice they will never overlap.
diffs[path][fingerprint].append(arch)
Expand Down Expand Up @@ -99,9 +100,9 @@ def format_diffs(ds):
return '\n'.join(sorted(
' {archs} -> {fingerprint}'.format(archs=', '.join(sorted(archs)),
fingerprint=fingerprint)
for fingerprint, archs in ds.iteritems()))
for fingerprint, archs in ds.items()))

for p, ds in sorted(diffs.iteritems()):
for p, ds in sorted(diffs.items()):
if len(ds) <= 1:
# Only one hash across all inputs: roll on.
continue
Expand All @@ -113,7 +114,7 @@ def format_diffs(ds):

not_allowed[p] = ds

for p, ds in not_allowed.iteritems():
for p, ds in not_allowed.items():
print('Disallowed: Path "{path}" has architecture-specific versions:\n{ds_repr}'.format(
path=p, ds_repr=format_diffs(ds)))

Expand Down

0 comments on commit 0fa5089

Please sign in to comment.