From 04f4db882843b45d295ff890ea1c9cf99614c3cc Mon Sep 17 00:00:00 2001 From: Daniel Varga Date: Tue, 10 Mar 2020 21:13:18 +0200 Subject: [PATCH] Backed out 13 changesets (bug 1620744) for causing diffoscope failures firefox/browser/chrome/browser/content/browser/built_in_addons.json CLOSED TREE Backed out changeset 6beda54bcb9b (bug 1620744) Backed out changeset a1e97f0b91ef (bug 1620744) Backed out changeset b8faa0184d4f (bug 1620744) Backed out changeset 3bc8fda68107 (bug 1620744) Backed out changeset 8e95b21b2ae3 (bug 1620744) Backed out changeset 1de09de1a802 (bug 1620744) Backed out changeset 622a2f7414fa (bug 1620744) Backed out changeset 3372c9ab721c (bug 1620744) Backed out changeset 0997313a9f99 (bug 1620744) Backed out changeset 2fa34749bbfa (bug 1620744) Backed out changeset 6d597d2eb792 (bug 1620744) Backed out changeset 78e78f7c7b26 (bug 1620744) Backed out changeset 6e4d85b19f88 (bug 1620744) --- Makefile.in | 8 ++++---- browser/app/Makefile.in | 2 +- browser/installer/Makefile.in | 2 +- browser/installer/windows/Makefile.in | 2 +- build/variables.py | 3 +-- config/makefiles/rust.mk | 2 +- config/rules.mk | 18 +++++++++--------- layout/tools/reftest/reftest/__init__.py | 5 ++--- .../geckoview/src/androidTest/assets/moz.build | 1 + moz.build | 1 + mozglue/build/Makefile.in | 2 +- mozglue/dllservices/gen_dll_blocklist_defs.py | 18 ++++++++++++------ mozglue/dllservices/moz.build | 1 + netwerk/dns/prepare_tlds.py | 2 ++ netwerk/dns/tests/unit/data/moz.build | 1 + .../mozbuild/mozbuild/action/check_binary.py | 4 ++-- python/mozbuild/mozbuild/action/dumpsymbols.py | 4 ++-- python/mozbuild/mozbuild/action/fat_aar.py | 9 ++++----- .../mozbuild/action/generate_symbols_file.py | 2 +- .../mozbuild/action/process_define_files.py | 2 +- .../mozbuild/mozbuild/backend/recursivemake.py | 8 ++++---- python/mozbuild/mozbuild/frontend/emitter.py | 4 ++-- .../mozbuild/mozbuild/frontend/gyp_reader.py | 1 + python/mozbuild/mozbuild/generated_sources.py | 2 +- python/mozbuild/mozbuild/jar.py | 2 +- .../mozbuild/test/backend/test_build.py | 1 - security/generate_mapfile.py | 2 +- testing/testsuite-targets.mk | 2 +- toolkit/mozapps/extensions/moz.build | 1 + toolkit/mozapps/installer/packager.mk | 6 +++--- toolkit/mozapps/installer/upload-files.mk | 14 +++++++------- .../mozapps/installer/windows/nsis/makensis.mk | 4 ++-- 32 files changed, 73 insertions(+), 63 deletions(-) diff --git a/Makefile.in b/Makefile.in index c31d400cac6a7..ecc57aff08b85 100644 --- a/Makefile.in +++ b/Makefile.in @@ -140,7 +140,7 @@ endif ifdef MOZ_ANDROID_FAT_AAR_ARCHITECTURES recurse_android-fat-aar-artifact: - $(call py3_action,fat_aar,\ + $(call py_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)) \ @@ -196,14 +196,14 @@ endif .PHONY: symbolsfullarchive symbolsfullarchive: prepsymbolsarchive $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' - $(call py3_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \ + $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \ $(abspath $(DIST)/crashreporter-symbols) \ --full-archive) .PHONY: symbolsarchive symbolsarchive: prepsymbolsarchive $(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' - $(call py3_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \ + $(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' \ $(abspath $(DIST)/crashreporter-symbols)) ifdef MOZ_CRASHREPORTER @@ -229,7 +229,7 @@ update-packaging: .PHONY: package-generated-sources package-generated-sources: - $(call py3_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)') + $(call py_action,package_generated_sources,'$(DIST)/$(PKG_PATH)$(GENERATED_SOURCE_FILE_PACKAGE)') ifdef JS_STANDALONE # Delegate js-specific rules to js diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in index f0fab52e5b327..7bf4adfaf3229 100644 --- a/browser/app/Makefile.in +++ b/browser/app/Makefile.in @@ -56,7 +56,7 @@ endif # steps. See bug 1431342. libs:: $(srcdir)/profile/channel-prefs.js $(NSINSTALL) -D $(DIST)/bin/defaults/pref - $(call py3_action,preprocessor,-Fsubstitution $(PREF_PPFLAGS) $(ACDEFINES) $^ -o $(DIST)/bin/defaults/pref/channel-prefs.js) + $(call py_action,preprocessor,-Fsubstitution $(PREF_PPFLAGS) $(ACDEFINES) $^ -o $(DIST)/bin/defaults/pref/channel-prefs.js) ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) diff --git a/browser/installer/Makefile.in b/browser/installer/Makefile.in index 7f19366fe4ef9..07035b61986a6 100644 --- a/browser/installer/Makefile.in +++ b/browser/installer/Makefile.in @@ -173,7 +173,7 @@ endif package-compare:: cd $(DIST); find $(PKGCOMP_FIND_OPTS) '$(FINDPATH)' -type f | sort > bin-list.txt - $(call py3_action,preprocessor,$(DEFINES) $(ACDEFINES) $(MOZ_PKG_MANIFEST)) | grep '^$(BINPATH)' | sed -e 's/^\///' | sort > $(DIST)/pack-list.txt + $(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $(MOZ_PKG_MANIFEST)) | grep '^$(BINPATH)' | sed -e 's/^\///' | sort > $(DIST)/pack-list.txt -diff -u $(DIST)/pack-list.txt $(DIST)/bin-list.txt rm -f $(DIST)/pack-list.txt $(DIST)/bin-list.txt diff --git a/browser/installer/windows/Makefile.in b/browser/installer/windows/Makefile.in index 610934d247b55..b51883db20181 100644 --- a/browser/installer/windows/Makefile.in +++ b/browser/installer/windows/Makefile.in @@ -53,7 +53,7 @@ $(CONFIG_DIR)/setup.exe:: $(MKDIR) $(CONFIG_DIR) $(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR) $(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR) - $(call py3_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \ + $(call py_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \ $(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi) $(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \ --preprocess-locale $(topsrcdir) \ diff --git a/build/variables.py b/build/variables.py index 01ae2f0d8bc28..86dfe508295ed 100644 --- a/build/variables.py +++ b/build/variables.py @@ -25,8 +25,7 @@ def buildid_header(output): def get_program_output(*command): try: with open(os.devnull) as stderr: - return subprocess.check_output(command, stderr=stderr, - universal_newlines=True) + return subprocess.check_output(command, stderr=stderr) except Exception: return '' diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk index a272c9d9b9f36..2a433bc3867f7 100644 --- a/config/makefiles/rust.mk +++ b/config/makefiles/rust.mk @@ -297,7 +297,7 @@ ifndef MOZ_TSAN ifeq ($(OS_ARCH), Linux) ifeq (,$(rustflags_sancov)) ifneq (,$(filter -Clto,$(cargo_rustc_flags))) - $(call py3_action,check_binary,--target --networking $@) + $(call py_action,check_binary,--target --networking $@) endif endif endif diff --git a/config/rules.mk b/config/rules.mk index d1412acd8f32a..2345df2ad8f9c 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -474,7 +474,7 @@ ifdef MSMANIFEST_TOOL endif # MSVC with manifest tool else # !WINNT || GNU_CC $(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $($(notdir $@)_OBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) - $(call py3_action,check_binary,--target $@) + $(call py_action,check_binary,--target $@) endif # WINNT && !GNU_CC ifdef ENABLE_STRIP @@ -505,7 +505,7 @@ else endif # HOST_CPP_PROG_LINK endif ifndef CROSS_COMPILE - $(call py3_action,check_binary,--host $@) + $(call py_action,check_binary,--host $@) endif # @@ -530,7 +530,7 @@ ifdef MSMANIFEST_TOOL endif # MSVC with manifest tool else $(call EXPAND_CC_OR_CXX,$@) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) -o $@ $($@_OBJS) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS) - $(call py3_action,check_binary,--target $@) + $(call py_action,check_binary,--target $@) endif # WINNT && !GNU_CC ifdef ENABLE_STRIP @@ -552,7 +552,7 @@ else endif endif ifndef CROSS_COMPILE - $(call py3_action,check_binary,--host $@) + $(call py_action,check_binary,--host $@) endif $(LIBRARY): $(OBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS) @@ -610,7 +610,7 @@ ifndef INCREMENTAL_LINKER $(RM) $@ endif $(MKSHLIB) $($@_OBJS) $(RESFILE) $(LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS) - $(call py3_action,check_binary,--target $@) + $(call py_action,check_binary,--target $@) ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) ifdef MSMANIFEST_TOOL @@ -702,7 +702,7 @@ define syms_template syms:: $(2) $(2): $(1) ifdef MOZ_CRASHREPORTER - $$(call py3_action,dumpsymbols,$$(abspath $$<) $$(abspath $$@) $$(DUMP_SYMBOLS_FLAGS)) + $$(call py_action,dumpsymbols,$$(abspath $$<) $$(abspath $$@) $$(DUMP_SYMBOLS_FLAGS)) endif endef @@ -936,7 +936,7 @@ endif endif libs realchrome:: $(FINAL_TARGET)/chrome - $(call py3_action,jar_maker,\ + $(call py_action,jar_maker,\ $(QUIET) -d $(FINAL_TARGET) \ $(MAKE_JARS_FLAGS) $(DEFINES) $(ACDEFINES) \ $(JAR_MANIFEST)) @@ -979,7 +979,7 @@ ifndef MOZ_DEBUG endif endif @echo 'Packaging $(XPI_PKGNAME).xpi...' - $(call py3_action,zip,-C $(FINAL_TARGET) ../$(XPI_PKGNAME).xpi '*') + $(call py_action,zip,-C $(FINAL_TARGET) ../$(XPI_PKGNAME).xpi '*') endif # See comment above about moving this out of the tools tier. @@ -1159,7 +1159,7 @@ PP_TARGETS_ALL_RESULTS := $(sort $(foreach tier,$(PP_TARGETS_TIERS),$(PP_TARGETS $(PP_TARGETS_ALL_RESULTS): $(if $(filter-out $(notdir $@),$(notdir $(<:.in=))),$(error Looks like $@ has an unexpected dependency on $< which breaks PP_TARGETS)) $(RM) '$@' - $(call py3_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) '$<' -o '$@') + $(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) '$<' -o '$@') $(filter %.css,$(PP_TARGETS_ALL_RESULTS)): PP_TARGET_FLAGS+=--marker % diff --git a/layout/tools/reftest/reftest/__init__.py b/layout/tools/reftest/reftest/__init__.py index 5f7ae473656c2..79e060fa73455 100644 --- a/layout/tools/reftest/reftest/__init__.py +++ b/layout/tools/reftest/reftest/__init__.py @@ -6,7 +6,6 @@ import os import re -import six RE_COMMENT = re.compile(r'\s+#') RE_HTTP = re.compile(r'HTTP\((\.\.(\/\.\.)*)\)') @@ -97,14 +96,14 @@ def add_test(file, annotations, referenced_test=None): if self.finder: lines = self.finder.get(path).read().splitlines() else: - with open(path, 'r', encoding='utf-8') as fh: + with open(path, 'r') as fh: lines = fh.read().splitlines() urlprefix = '' defaults = [] for i, line in enumerate(lines): lineno = i + 1 - line = six.ensure_text(line) + line = line.decode('utf-8') # Entire line is a comment. if line.startswith('#'): diff --git a/mobile/android/geckoview/src/androidTest/assets/moz.build b/mobile/android/geckoview/src/androidTest/assets/moz.build index 809311df7a8d4..6d0b3aead6b82 100644 --- a/mobile/android/geckoview/src/androidTest/assets/moz.build +++ b/mobile/android/geckoview/src/androidTest/assets/moz.build @@ -19,6 +19,7 @@ for addon in addons: GENERATED_FILES += [xpi] GENERATED_FILES[xpi].script = '../../../../../../toolkit/mozapps/extensions/test/create_xpi.py' + GENERATED_FILES[xpi].py2 = True GENERATED_FILES[xpi].inputs = [indir] TEST_HARNESS_FILES.testing.mochitest.tests.junit += ['!%s' % xpi] diff --git a/moz.build b/moz.build index 76fa51a8bfb57..e4aab1d84c6c2 100644 --- a/moz.build +++ b/moz.build @@ -164,6 +164,7 @@ if not CONFIG['JS_STANDALONE'] or not CONFIG['MOZ_BUILD_APP']: GENERATED_FILES['buildid.h'].script = 'build/variables.py:buildid_header' GENERATED_FILES['source-repo.h'].script = 'build/variables.py:source_repo_header' + GENERATED_FILES['source-repo.h'].py2 = True DIRS += [ 'build', diff --git a/mozglue/build/Makefile.in b/mozglue/build/Makefile.in index 78c3847830dcb..b25e1447101c7 100644 --- a/mozglue/build/Makefile.in +++ b/mozglue/build/Makefile.in @@ -8,7 +8,7 @@ include $(topsrcdir)/config/config.mk ifeq (WINNT,$(OS_TARGET)) mozglue.def: $(srcdir)/mozglue.def.in $(GLOBAL_DEPS) - $(call py3_action,preprocessor,$(if $(MOZ_REPLACE_MALLOC),-DMOZ_REPLACE_MALLOC) $(ACDEFINES) $< -o $@) + $(call py_action,preprocessor,$(if $(MOZ_REPLACE_MALLOC),-DMOZ_REPLACE_MALLOC) $(ACDEFINES) $< -o $@) GARBAGE += mozglue.def diff --git a/mozglue/dllservices/gen_dll_blocklist_defs.py b/mozglue/dllservices/gen_dll_blocklist_defs.py index ecda2baa13df9..d55de948ad5f6 100644 --- a/mozglue/dllservices/gen_dll_blocklist_defs.py +++ b/mozglue/dllservices/gen_dll_blocklist_defs.py @@ -278,7 +278,9 @@ def add_list_flags(elem): # Sort the list on entry name so that the blocklist code may use # binary search if it so chooses. - return sorted(filtered_list, key=lambda e: e.get_name()) + filtered_list.sort(key=lambda e: e.get_name()) + + return filtered_list @staticmethod def get_fd(outspec_leaf_name): @@ -369,7 +371,11 @@ def write(self, src_file, exec_env): class PETimeStamp(object): def __init__(self, ts): - max_timestamp = (2 ** 32) - 1 + # Since we can't specify the long literal suffix in python 3, we'll + # compute max_timestamp this way to ensure that it is defined as a + # long in python 2 + max_timestamp = (long(2) ** 32) - 1 + assert isinstance(max_timestamp, long) if ts < 0 or ts > max_timestamp: raise ValueError('Invalid timestamp value') self._value = ts @@ -407,7 +413,7 @@ def __init__(self, *args): elif isinstance(args[0], PETimeStamp): self._ver = args[0] else: - self._ver = int(args[0]) + self._ver = long(args[0]) elif len(args) == 4: self.validate_iterable(args) @@ -427,14 +433,14 @@ def validate_iterable(self, arg): def build_long(self, args): self.validate_iterable(args) - return (int(args[0]) << 48) | (int(args[1]) << 32) | \ - (int(args[2]) << 16) | int(args[3]) + return (long(args[0]) << 48) | (long(args[1]) << 32) | \ + (long(args[2]) << 16) | long(args[3]) def is_timestamp(self): return isinstance(self._ver, PETimeStamp) def __str__(self): - if isinstance(self._ver, int): + if isinstance(self._ver, long): if self._ver == Version.ALL_VERSIONS: return 'DllBlockInfo::ALL_VERSIONS' diff --git a/mozglue/dllservices/moz.build b/mozglue/dllservices/moz.build index ba73d8c7ef1c9..3cafc915e361a 100644 --- a/mozglue/dllservices/moz.build +++ b/mozglue/dllservices/moz.build @@ -53,6 +53,7 @@ GENERATED_FILES += [ blocklist_defs = GENERATED_FILES[blocklist_files] blocklist_defs.script = 'gen_dll_blocklist_defs.py:gen_blocklists' blocklist_defs.inputs = ['WindowsDllBlocklistDefs.in'] +blocklist_defs.py2 = True EXPORTS.mozilla += ['!' + hdr for hdr in blocklist_files] FINAL_LIBRARY = 'mozglue' diff --git a/netwerk/dns/prepare_tlds.py b/netwerk/dns/prepare_tlds.py index 9874f3cac465e..c4235d1f145bd 100644 --- a/netwerk/dns/prepare_tlds.py +++ b/netwerk/dns/prepare_tlds.py @@ -126,6 +126,8 @@ def dafsa_words(): """ words_to_bin() returns a bytes while words_to_cxx() returns string """ if output_format == "bin": + if sys.version_info[0] >= 3: + output = output.buffer output.write(words_to_bin(dafsa_words())) else: output.write(words_to_cxx(dafsa_words())) diff --git a/netwerk/dns/tests/unit/data/moz.build b/netwerk/dns/tests/unit/data/moz.build index 461d3ab06e146..e0d6e0696d1eb 100644 --- a/netwerk/dns/tests/unit/data/moz.build +++ b/netwerk/dns/tests/unit/data/moz.build @@ -10,5 +10,6 @@ fake_remote_dafsa = GENERATED_FILES['fake_remote_dafsa.bin'] fake_remote_dafsa.script = '../../../prepare_tlds.py' fake_remote_dafsa.inputs = ['fake_public_suffix_list.dat'] fake_remote_dafsa.flags = ['bin'] +fake_remote_dafsa.py2 = True TEST_HARNESS_FILES.xpcshell.netwerk.dns.tests.unit.data += ['!fake_remote_dafsa.bin'] diff --git a/python/mozbuild/mozbuild/action/check_binary.py b/python/mozbuild/mozbuild/action/check_binary.py index 4ac56f81205d3..d85536f2672e0 100644 --- a/python/mozbuild/mozbuild/action/check_binary.py +++ b/python/mozbuild/mozbuild/action/check_binary.py @@ -56,7 +56,7 @@ def get_output(*cmd): env = dict(os.environ) env[b'LC_ALL'] = b'C' - return subprocess.check_output(cmd, env=env, universal_newlines=True).splitlines() + return subprocess.check_output(cmd, env=env).splitlines() class Skip(RuntimeError): @@ -86,7 +86,7 @@ def iter_symbols(binary): # platforms for static libraries, but its format is different for # Windows .obj files, so the following won't work for them, but # it currently doesn't matter. - if ty == UNKNOWN and open(binary, 'rb').read(8) == b'!\n': + if ty == UNKNOWN and open(binary).read(8) == '!\n': ty = ELF if ty in (ELF, MACHO): for line in get_output(buildconfig.substs['LLVM_OBJDUMP'], '-t', diff --git a/python/mozbuild/mozbuild/action/dumpsymbols.py b/python/mozbuild/mozbuild/action/dumpsymbols.py index db37cea2a6b4a..186db22861c4e 100644 --- a/python/mozbuild/mozbuild/action/dumpsymbols.py +++ b/python/mozbuild/mozbuild/action/dumpsymbols.py @@ -80,8 +80,8 @@ def dump_symbols(target, tracking_file, count_ctors=False): if count_ctors: args.append('--count-ctors') print('Running: %s' % ' '.join(args)) - out_files = subprocess.check_output(args, universal_newlines=True) - with open(tracking_file, 'w', encoding='utf-8', newline='\n') as fh: + out_files = subprocess.check_output(args) + with open(tracking_file, 'w') as fh: fh.write(out_files) fh.flush() diff --git a/python/mozbuild/mozbuild/action/fat_aar.py b/python/mozbuild/mozbuild/action/fat_aar.py index faf69b4ad7f98..e59236e49e5e8 100644 --- a/python/mozbuild/mozbuild/action/fat_aar.py +++ b/python/mozbuild/mozbuild/action/fat_aar.py @@ -10,7 +10,6 @@ from __future__ import absolute_import, unicode_literals, print_function import argparse -import six import sys from collections import ( @@ -71,7 +70,7 @@ def fat_aar(distdir, aars_paths, no_process=False, no_compatibility_check=False) diffs['{}!/{}'.format(path, r)][fingerprint].append(arch) else: - fingerprint = sha1(six.ensure_binary(fileobj.open().read())).hexdigest() + fingerprint = sha1(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) @@ -100,9 +99,9 @@ def format_diffs(ds): return '\n'.join(sorted( ' {archs} -> {fingerprint}'.format(archs=', '.join(sorted(archs)), fingerprint=fingerprint) - for fingerprint, archs in ds.items())) + for fingerprint, archs in ds.iteritems())) - for p, ds in sorted(diffs.items()): + for p, ds in sorted(diffs.iteritems()): if len(ds) <= 1: # Only one hash across all inputs: roll on. continue @@ -114,7 +113,7 @@ def format_diffs(ds): not_allowed[p] = ds - for p, ds in not_allowed.items(): + for p, ds in not_allowed.iteritems(): print('Disallowed: Path "{path}" has architecture-specific versions:\n{ds_repr}'.format( path=p, ds_repr=format_diffs(ds))) diff --git a/python/mozbuild/mozbuild/action/generate_symbols_file.py b/python/mozbuild/mozbuild/action/generate_symbols_file.py index 4b8acf10e27c0..e57e131aa7efc 100644 --- a/python/mozbuild/mozbuild/action/generate_symbols_file.py +++ b/python/mozbuild/mozbuild/action/generate_symbols_file.py @@ -7,7 +7,7 @@ import argparse import buildconfig import os -from io import StringIO +from StringIO import StringIO from mozbuild.preprocessor import Preprocessor from mozbuild.util import DefinesAction diff --git a/python/mozbuild/mozbuild/action/process_define_files.py b/python/mozbuild/mozbuild/action/process_define_files.py index 6fff0d1d64c85..2b846dd50ec38 100644 --- a/python/mozbuild/mozbuild/action/process_define_files.py +++ b/python/mozbuild/mozbuild/action/process_define_files.py @@ -63,7 +63,7 @@ def define_for_name(name, val): return define defines = '\n'.join(sorted( define_for_name(name, val) - for name, val in config.defines['ALLDEFINES'].items())) + for name, val in config.defines['ALLDEFINES'].iteritems())) l = l[:m.start('cmd') - 1] \ + defines + l[m.end('name'):] elif cmd == 'define': diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 24b26fee2aac5..2695d758e2a89 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -1591,13 +1591,13 @@ def _process_chrome_manifest_entry(self, obj, backend_file): mozpath.relpath(obj.path, obj.install_target))), ] - rule.add_commands(['$(call py3_action,buildlist,%s)' % + rule.add_commands(['$(call py_action,buildlist,%s)' % ' '.join(args)]) args = [ mozpath.join('$(DEPTH)', obj.path), make_quote(shell_quote(str(obj.entry))), ] - rule.add_commands(['$(call py3_action,buildlist,%s)' % ' '.join(args)]) + rule.add_commands(['$(call py_action,buildlist,%s)' % ' '.join(args)]) fragment.dump(backend_file.fh, removal_guard=False) self._no_skip['misc'].add(obj.relsrcdir) @@ -1683,7 +1683,7 @@ def _handle_ipdl_sources(self, ipdl_dir, sorted_ipdl_sources, sorted_nonstatic_i rule.add_dependencies([source]) rule.add_commands([ '$(RM) $@', - '$(call py3_action,preprocessor,$(DEFINES) $(ACDEFINES) ' + '$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) ' '$< -o $@)' ]) @@ -1738,7 +1738,7 @@ def _handle_webidl_build(self, bindings_dir, unified_source_mapping, # static to preprocessed don't end up writing to a symlink, # which would modify content in the source directory. '$(RM) $@', - '$(call py3_action,preprocessor,$(DEFINES) $(ACDEFINES) ' + '$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) ' '$< -o $@)' ]) diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index cfd479577787a..009e0fb26d0f5 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -840,7 +840,7 @@ def check_unique_binary(program, kind): defines = lib.defines.get_defines() yield GeneratedFile(context, script, 'generate_symbols_file', lib.symbols_file, - [symbols_file], defines) + [symbols_file], defines, py2=True) if static_lib: is_rust_library = context.get('IS_RUST_LIBRARY') if is_rust_library: @@ -1478,7 +1478,7 @@ def _process_generated_files(self, context): 'action', 'process_define_files.py') yield GeneratedFile(context, script, 'process_define_file', six.text_type(path), - [Path(context, path + '.in')]) + [Path(context, path + '.in')], py2=True) generated_files = context.get('GENERATED_FILES') or [] localized_generated_files = context.get('LOCALIZED_GENERATED_FILES') or [] diff --git a/python/mozbuild/mozbuild/frontend/gyp_reader.py b/python/mozbuild/mozbuild/frontend/gyp_reader.py index 9fee0c82de829..95fcb2f5d844d 100644 --- a/python/mozbuild/mozbuild/frontend/gyp_reader.py +++ b/python/mozbuild/mozbuild/frontend/gyp_reader.py @@ -94,6 +94,7 @@ def handle_actions(actions, context, action_overrides): g = context['GENERATED_FILES'][output] g.script = action_overrides[name] g.inputs = action['inputs'] + g.py2 = True def handle_copies(copies, context): diff --git a/python/mozbuild/mozbuild/generated_sources.py b/python/mozbuild/mozbuild/generated_sources.py index 84dc75457dc84..af8cbe496f2bc 100644 --- a/python/mozbuild/mozbuild/generated_sources.py +++ b/python/mozbuild/mozbuild/generated_sources.py @@ -39,7 +39,7 @@ def get_generated_sources(): # First, get the list of generated sources produced by the build backend. gen_sources = os.path.join(buildconfig.topobjdir, 'generated-sources.json') - with open(gen_sources, 'r') as f: + with open(gen_sources, 'rb') as f: data = json.load(f) for f in data['sources']: yield f, mozpath.join(buildconfig.topobjdir, f) diff --git a/python/mozbuild/mozbuild/jar.py b/python/mozbuild/mozbuild/jar.py index 8d6d4aa5c2171..6684a0b2f2f19 100644 --- a/python/mozbuild/mozbuild/jar.py +++ b/python/mozbuild/mozbuild/jar.py @@ -49,7 +49,7 @@ def __init__(self, name, zipfile): def write(self, content): '''Append the given content to this zip entry''' - self._inner.write(ensure_bytes(content)) + self._inner.write(content) return def close(self): diff --git a/python/mozbuild/mozbuild/test/backend/test_build.py b/python/mozbuild/mozbuild/test/backend/test_build.py index 50cdf7c3b5aff..96955a1628402 100644 --- a/python/mozbuild/mozbuild/test/backend/test_build.py +++ b/python/mozbuild/mozbuild/test/backend/test_build.py @@ -26,7 +26,6 @@ BASE_SUBSTS = [ ('PYTHON', mozpath.normsep(sys.executable)), - ('PYTHON3', mozpath.normsep(sys.executable)), ('MOZ_UI_LOCALE', 'en-US'), ] diff --git a/security/generate_mapfile.py b/security/generate_mapfile.py index 4c88172d67b0e..7cf215bf27519 100644 --- a/security/generate_mapfile.py +++ b/security/generate_mapfile.py @@ -25,7 +25,7 @@ def main(output, input): is_mingw = "WINNT" == buildconfig.substs['OS_ARCH'] and \ buildconfig.substs.get('GCC_USE_GNU_LD') - with open(input, 'r', encoding='utf-8') as f: + with open(input, 'rb') as f: for line in f: line = line.rstrip() # On everything except MinGW, remove all lines containing ';-' diff --git a/testing/testsuite-targets.mk b/testing/testsuite-targets.mk index 9e4da3321f8ee..fecd15ee72411 100644 --- a/testing/testsuite-targets.mk +++ b/testing/testsuite-targets.mk @@ -156,7 +156,7 @@ download-wpt-manifest: define package_archive package-tests-$(1): stage-all package-tests-prepare-dest download-wpt-manifest - $$(call py3_action,test_archive, \ + $$(call py_action,test_archive, \ $(1) \ '$$(abspath $$(test_archive_dir))/$$(PKG_BASENAME).$(1).tests.$(2)') package-tests: package-tests-$(1) diff --git a/toolkit/mozapps/extensions/moz.build b/toolkit/mozapps/extensions/moz.build index f16056dda3596..4e0a62c441228 100644 --- a/toolkit/mozapps/extensions/moz.build +++ b/toolkit/mozapps/extensions/moz.build @@ -32,6 +32,7 @@ built_in_addons = 'built_in_addons.json' GENERATED_FILES += [built_in_addons] manifest = GENERATED_FILES[built_in_addons] manifest.script = 'gen_built_in_addons.py' +manifest.py2 = True if CONFIG['MOZ_BUILD_APP'] == 'browser': manifest.flags = ['--features=browser/features'] diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index 372225ad25174..f04fc004aab91 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -42,7 +42,7 @@ endif # RUN_FIND_DUPES ifndef MOZ_IS_COMM_TOPDIR ifdef RUN_MOZHARNESS_ZIP # Package mozharness - $(call py3_action,test_archive, \ + $(call py_action,test_archive, \ mozharness \ $(ABS_DIST)/$(PKG_PATH)$(MOZHARNESS_PACKAGE)) endif # RUN_MOZHARNESS_ZIP @@ -211,14 +211,14 @@ endif # and places it in dist/bin/res - it should be used when packaging a build. multilocale.txt: LOCALES?=$(MOZ_CHROME_MULTILOCALE) multilocale.txt: - $(call py3_action,file_generate,$(MOZILLA_DIR)/toolkit/locales/gen_multilocale.py main '$(MULTILOCALE_DIR)/multilocale.txt' $(MDDEPDIR)/multilocale.txt.pp '$(MULTILOCALE_DIR)/multilocale.txt' $(ALL_LOCALES)) + $(call py_action,file_generate,$(MOZILLA_DIR)/toolkit/locales/gen_multilocale.py main '$(MULTILOCALE_DIR)/multilocale.txt' $(MDDEPDIR)/multilocale.txt.pp '$(MULTILOCALE_DIR)/multilocale.txt' $(ALL_LOCALES)) # This version of the target uses AB_CD to build multilocale.txt and places it # in the $(XPI_NAME)/res dir - it should be used when repackaging a build. multilocale.txt-%: LOCALES?=$(AB_CD) multilocale.txt-%: MULTILOCALE_DIR=$(DIST)/xpi-stage/$(XPI_NAME)/res multilocale.txt-%: - $(call py3_action,file_generate,$(MOZILLA_DIR)/toolkit/locales/gen_multilocale.py main '$(MULTILOCALE_DIR)/multilocale.txt' $(MDDEPDIR)/multilocale.txt.pp '$(MULTILOCALE_DIR)/multilocale.txt' $(ALL_LOCALES)) + $(call py_action,file_generate,$(MOZILLA_DIR)/toolkit/locales/gen_multilocale.py main '$(MULTILOCALE_DIR)/multilocale.txt' $(MDDEPDIR)/multilocale.txt.pp '$(MULTILOCALE_DIR)/multilocale.txt' $(ALL_LOCALES)) locale-manifest.in: LOCALES?=$(MOZ_CHROME_MULTILOCALE) locale-manifest.in: $(GLOBAL_DEPS) FORCE diff --git a/toolkit/mozapps/installer/upload-files.mk b/toolkit/mozapps/installer/upload-files.mk index 693c02e9e59c3..3858e63d51130 100644 --- a/toolkit/mozapps/installer/upload-files.mk +++ b/toolkit/mozapps/installer/upload-files.mk @@ -91,7 +91,7 @@ ifdef FUZZING_INTERFACES JSSHELL_BINS += fuzz-tests$(BIN_SUFFIX) endif -MAKE_JSSHELL = $(call py3_action,zip,-C $(DIST)/bin --strip $(abspath $(PKG_JSSHELL)) $(JSSHELL_BINS)) +MAKE_JSSHELL = $(call py_action,zip,-C $(DIST)/bin --strip $(abspath $(PKG_JSSHELL)) $(JSSHELL_BINS)) ifneq (,$(PGO_JARLOG_PATH)) # The backslash subst is to work around an issue with our version of mozmake, @@ -134,14 +134,14 @@ endif ifeq ($(MOZ_PKG_FORMAT),ZIP) PKG_SUFFIX = .zip - INNER_MAKE_PACKAGE = $(call py3_action,make_zip,'$(MOZ_PKG_DIR)' '$(PACKAGE)') - INNER_UNMAKE_PACKAGE = $(call py3_action,make_unzip,$(UNPACKAGE)) + INNER_MAKE_PACKAGE = $(call py_action,make_zip,'$(MOZ_PKG_DIR)' '$(PACKAGE)') + INNER_UNMAKE_PACKAGE = $(call py_action,make_unzip,$(UNPACKAGE)) endif ifeq ($(MOZ_PKG_FORMAT),SFX7Z) PKG_SUFFIX = .exe - INNER_MAKE_PACKAGE = $(call py3_action,exe_7z_archive,'$(MOZ_PKG_DIR)' '$(MOZ_INSTALLER_PATH)/app.tag' '$(MOZ_SFX_PACKAGE)' '$(PACKAGE)') - INNER_UNMAKE_PACKAGE = $(call py3_action,exe_7z_extract,$(UNPACKAGE) $(MOZ_PKG_DIR)) + INNER_MAKE_PACKAGE = $(call py_action,exe_7z_archive,'$(MOZ_PKG_DIR)' '$(MOZ_INSTALLER_PATH)/app.tag' '$(MOZ_SFX_PACKAGE)' '$(PACKAGE)') + INNER_UNMAKE_PACKAGE = $(call py_action,exe_7z_extract,$(UNPACKAGE) $(MOZ_PKG_DIR)) endif #Create an RPM file @@ -231,7 +231,7 @@ ifeq ($(MOZ_PKG_FORMAT),DMG) _ABS_MOZSRCDIR = $(shell cd $(MOZILLA_DIR) && pwd) PKG_DMG_SOURCE = $(MOZ_PKG_DIR) INNER_MAKE_PACKAGE = \ - $(call py3_action,make_dmg, \ + $(call py_action,make_dmg, \ $(if $(MOZ_PKG_MAC_DSSTORE),--dsstore '$(MOZ_PKG_MAC_DSSTORE)') \ $(if $(MOZ_PKG_MAC_BACKGROUND),--background '$(MOZ_PKG_MAC_BACKGROUND)') \ $(if $(MOZ_PKG_MAC_ICON),--icon '$(MOZ_PKG_MAC_ICON)') \ @@ -239,7 +239,7 @@ ifeq ($(MOZ_PKG_FORMAT),DMG) '$(PKG_DMG_SOURCE)' '$(PACKAGE)' \ ) INNER_UNMAKE_PACKAGE = \ - $(call py3_action,unpack_dmg, \ + $(call py_action,unpack_dmg, \ $(if $(MOZ_PKG_MAC_DSSTORE),--dsstore '$(MOZ_PKG_MAC_DSSTORE)') \ $(if $(MOZ_PKG_MAC_BACKGROUND),--background '$(MOZ_PKG_MAC_BACKGROUND)') \ $(if $(MOZ_PKG_MAC_ICON),--icon '$(MOZ_PKG_MAC_ICON)') \ diff --git a/toolkit/mozapps/installer/windows/nsis/makensis.mk b/toolkit/mozapps/installer/windows/nsis/makensis.mk index e470865e0c50e..a48ada948e21c 100755 --- a/toolkit/mozapps/installer/windows/nsis/makensis.mk +++ b/toolkit/mozapps/installer/windows/nsis/makensis.mk @@ -98,7 +98,7 @@ $(CONFIG_DIR)/helper.exe: $(HELPER_DEPS) $(MKDIR) $(CONFIG_DIR) $(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR) $(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR) - $(call py3_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \ + $(call py_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \ $(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi) $(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \ --preprocess-locale $(topsrcdir) \ @@ -117,7 +117,7 @@ maintenanceservice_installer:: $(MKDIR) $(CONFIG_DIR) $(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR) $(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR) - $(call py3_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \ + $(call py_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \ $(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi) $(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \ --preprocess-locale $(topsrcdir) \