Backed out 13 changesets (bug 1620744) for causing diffoscope failures firefox/browser/chrome/browser/content/browser/built_in_addons.json
authorDaniel Varga <dvarga@mozilla.com>
Tue, 10 Mar 2020 21:13:18 +0200
changeset 517914 ba409a89fb2bceefbd93f25c32d759cfc1aea9d7
parent 517913 2177e8ac584c9ec855ef6a3cd4939d404ba47a93
child 517915 53583c05b276128d499accc81474c8b19b5bab2f
push id37203
push userccoroiu@mozilla.com
push dateWed, 11 Mar 2020 04:11:49 +0000
treeherdermozilla-central@884162af76f5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1620744
milestone76.0a1
backs out6beda54bcb9b9c7e29c9ddbddd93052d9d30387a
a1e97f0b91efe18725b51c9d8235df3e33fbde1d
b8faa0184d4f7c253ae8ead4c5c7af03725e6ce1
3bc8fda68107bada50003b476a6b0c9e66a71f62
8e95b21b2ae3742ccb8ea68445db507683f564bf
1de09de1a80205c0ca9c39022f2901ecd10a7730
622a2f7414fa89b6791addf9767503bb6a99970a
3372c9ab721cdc356b18f6a8ed81649499fb652d
0997313a9f9972e40f9ead80281d1102e86c79a6
2fa34749bbfa965bc53f6352128383d4a6c7198f
6d597d2eb792a4f4b0e64c39024dd9334e4854bc
78e78f7c7b265d6d687567a35ec0500daa38e45d
6e4d85b19f88fbdc50ff5f8a836792ad1acc09f9
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
browser/app/Makefile.in
browser/installer/Makefile.in
browser/installer/windows/Makefile.in
build/variables.py
config/makefiles/rust.mk
config/rules.mk
layout/tools/reftest/reftest/__init__.py
mobile/android/geckoview/src/androidTest/assets/moz.build
moz.build
mozglue/build/Makefile.in
mozglue/dllservices/gen_dll_blocklist_defs.py
mozglue/dllservices/moz.build
netwerk/dns/prepare_tlds.py
netwerk/dns/tests/unit/data/moz.build
python/mozbuild/mozbuild/action/check_binary.py
python/mozbuild/mozbuild/action/dumpsymbols.py
python/mozbuild/mozbuild/action/fat_aar.py
python/mozbuild/mozbuild/action/generate_symbols_file.py
python/mozbuild/mozbuild/action/process_define_files.py
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/gyp_reader.py
python/mozbuild/mozbuild/generated_sources.py
python/mozbuild/mozbuild/jar.py
python/mozbuild/mozbuild/test/backend/test_build.py
security/generate_mapfile.py
testing/testsuite-targets.mk
toolkit/mozapps/extensions/moz.build
toolkit/mozapps/installer/packager.mk
toolkit/mozapps/installer/upload-files.mk
toolkit/mozapps/installer/windows/nsis/makensis.mk
--- a/Makefile.in
+++ b/Makefile.in
@@ -135,17 +135,17 @@ ifdef MOZ_EME_WIN32_ARTIFACT
 recurse_win32-artifact:
 	rm -rf $(DIST)/i686
 	$(topsrcdir)/mach --log-no-times artifact install --job $(if $(MOZ_PGO),win32-pgo,win32-opt) --no-tests --distdir $(DIST)/i686
 	mv $(DIST)/i686/bin/* $(DIST)/i686
 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)) \
     $(addprefix --x86-64 $(MOZ_FETCHES_DIR)/,$(MOZ_ANDROID_FAT_AAR_X86_64)) \
     --distdir $(abspath $(DIST)/fat-aar))
 endif
 
 ifeq ($(MOZ_BUILD_APP),mobile/android)
@@ -191,24 +191,24 @@ prepsymbolsarchive:
 
 ifndef MOZ_AUTOMATION
 prepsymbolsarchive: recurse_syms
 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
 # Set MOZ_DISABLE_FULL_SYMBOLS to disable generation and upload of the full
 # crashreporter symbols archives
 ifdef MOZ_DISABLE_FULL_SYMBOLS
 buildsymbols: symbolsarchive
 else
@@ -224,17 +224,17 @@ ifdef MOZ_CRASHREPORTER
 endif
 
 .PHONY: update-packaging
 update-packaging:
 	$(MAKE) -C tools/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
 check-%:
 	$(MAKE) -C js/src $@
 
 source-package install:
 	$(MAKE) -C js/src $@
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -51,17 +51,17 @@ GARBAGE += $(addprefix $(FINAL_TARGET)/d
 
 endif
 
 # channel-prefs.js is handled separate from other prefs due to bug 756325
 # DO NOT change the content of channel-prefs.js without taking the appropriate
 # 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))
 
 MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)
 
 ifdef MOZ_DEBUG
 MAC_APP_NAME := $(MAC_APP_NAME)Debug
 endif
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -168,15 +168,15 @@ endif
 ifeq (Darwin, $(OS_ARCH))
 FINDPATH = $(_APPNAME)/Contents/MacOS
 else
 FINDPATH=bin
 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
 
 ifdef ENABLE_MARIONETTE
 DEFINES += -DENABLE_MARIONETTE=1
 endif
--- a/browser/installer/windows/Makefile.in
+++ b/browser/installer/windows/Makefile.in
@@ -48,17 +48,17 @@ else
 PPL_LOCALE_ARGS=$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer
 endif
 
 $(CONFIG_DIR)/setup.exe::
 	$(RM) -r $(CONFIG_DIR)
 	$(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) \
 	  $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
 	$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
 	  --preprocess-single-file $(topsrcdir) \
 	  $(PPL_LOCALE_ARGS) $(CONFIG_DIR) \
 	  nsisstrings.properties nsisstrings.nlf
--- a/build/variables.py
+++ b/build/variables.py
@@ -20,18 +20,17 @@ def buildid_header(output):
     if not buildid:
         buildid = datetime.now().strftime('%Y%m%d%H%M%S')
     output.write("#define MOZ_BUILDID %s\n" % buildid)
 
 
 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 ''
 
 
 def get_hg_info(workdir):
     repo = get_program_output('hg', '-R', workdir, 'path', 'default')
     if repo:
         repo = repo.strip()
--- a/config/makefiles/rust.mk
+++ b/config/makefiles/rust.mk
@@ -292,17 +292,17 @@ force-cargo-library-build:
 # the chance of proxy bypasses originating from rust code.
 # The check only works when rust code is built with -Clto.
 # Enabling sancov or TSan also causes this to fail.
 ifndef MOZ_PROFILE_GENERATE
 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
 endif
 endif
 
 force-cargo-library-check:
 	$(call CARGO_CHECK) --lib $(cargo_target_flag) $(rust_features_flag)
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -469,17 +469,17 @@ ifdef MSMANIFEST_TOOL
 		exit 1; \
 	elif test -f '$(srcdir)/$(notdir $@).manifest'; then \
 		echo 'Embedding manifest from $(srcdir_rel)/$(notdir $@).manifest'; \
 		$(call WINEWRAP,$(MT)) -NOLOGO -MANIFEST '$(srcdir_rel)/$(notdir $@).manifest' -OUTPUTRESOURCE:$@\;1; \
 	fi
 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
 	$(STRIP) $(STRIP_FLAGS) $@
 endif
 ifdef MOZ_POST_PROGRAM_COMMAND
 	$(MOZ_POST_PROGRAM_COMMAND) $@
 endif
@@ -500,17 +500,17 @@ endif	# MSVC with manifest tool
 else
 ifeq ($(HOST_CPP_PROG_LINK),1)
 	$(HOST_CXX) -o $@ $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 else
 	$(HOST_CC) -o $@ $(HOST_C_LDFLAGS) $(HOST_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 endif # HOST_CPP_PROG_LINK
 endif
 ifndef CROSS_COMPILE
-	$(call py3_action,check_binary,--host $@)
+	$(call py_action,check_binary,--host $@)
 endif
 
 #
 # This is an attempt to support generation of multiple binaries
 # in one directory, it assumes everything to compile Foo is in
 # Foo.o (from either Foo.c or Foo.cpp).
 #
 # SIMPLE_PROGRAMS = Foo Bar
@@ -525,17 +525,17 @@ ifdef MSMANIFEST_TOOL
 		echo "Manifest in objdir is not supported"; \
 		exit 1; \
 	elif test -f '$(srcdir)/$(notdir $@).manifest'; then \
 		$(call WINEWRAP,$(MT)) -NOLOGO -MANIFEST '$(srcdir_rel)/$(notdir $@).manifest' -OUTPUTRESOURCE:$@\;1; \
 	fi
 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
 	$(STRIP) $(STRIP_FLAGS) $@
 endif
 ifdef MOZ_POST_PROGRAM_COMMAND
 	$(MOZ_POST_PROGRAM_COMMAND) $@
 endif
@@ -547,17 +547,17 @@ ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
 else
 ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
 	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXX_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 else
 	$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_C_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 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)
 	$(REPORT_BUILD)
 	$(RM) $(REAL_LIBRARY)
 	$(AR) $(AR_FLAGS) $($@_OBJS)
 
 $(WASM_ARCHIVE): $(CWASMOBJS) $(CPPWASMOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
@@ -605,17 +605,17 @@ endif
 # so no need to conditionalize on OS version or debugging format.
 
 $(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
 	$(REPORT_BUILD)
 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
 ifdef EMBED_MANIFEST_AT
 	@if test -f $@.manifest; then \
 		echo "Manifest in objdir is not supported"; \
 		exit 1; \
 	elif test -f '$(srcdir)/$@.manifest'; then \
@@ -697,17 +697,17 @@ ifdef ASFILES
 	$(REPORT_BUILD_VERBOSE)
 	$(call WINEWRAP,$(AS)) $(ASOUTOPTION)$@ $(ASFLAGS) $($(notdir $<)_FLAGS) $(AS_DASH_C_FLAG) $(call relativize,$<)
 endif
 
 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
 
 ifneq (,$(filter $(DIST)/bin%,$(FINAL_TARGET)))
 DUMP_SYMS_TARGETS := $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS)
 endif
 
 ifdef MOZ_AUTOMATION
@@ -931,17 +931,17 @@ endif
 ifneq (,$(DIST_SUBDIR))
 ifndef XPI_ROOT_APPID
 $(error XPI_ROOT_APPID is not defined - langpacks will break.)
 endif
 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))
 
 endif
 
 endif
 
@@ -974,17 +974,17 @@ ifndef MOZ_DEBUG
 			! -name '*.tbl' \
 			! -name '*.src' \
 			! -name '*.reg' \
 			$(PLATFORM_EXCLUDE_LIST) \
 			-exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
 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.
 ifdef INSTALL_EXTENSION_ID
 ifndef XPI_NAME
 $(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
 endif
 
@@ -1154,17 +1154,17 @@ pp_target_results = $(foreach file,$($(1
 $(foreach tier,$(PP_TARGETS_TIERS), \
   $(eval $(tier):: $(PP_TARGETS_RESULTS_$(tier))) \
 )
 
 PP_TARGETS_ALL_RESULTS := $(sort $(foreach tier,$(PP_TARGETS_TIERS),$(PP_TARGETS_RESULTS_$(tier))))
 $(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 %
 
 # The depfile is based on the filename, and we don't want conflicts. So check
 # there's only one occurrence of any given filename in PP_TARGETS_ALL_RESULTS.
 PP_TARGETS_ALL_RESULT_NAMES := $(notdir $(PP_TARGETS_ALL_RESULTS))
 $(foreach file,$(sort $(PP_TARGETS_ALL_RESULT_NAMES)), \
   $(if $(filter-out 1,$(words $(filter $(file),$(PP_TARGETS_ALL_RESULT_NAMES)))), \
--- a/layout/tools/reftest/reftest/__init__.py
+++ b/layout/tools/reftest/reftest/__init__.py
@@ -1,17 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import unicode_literals, absolute_import, print_function
 
 import os
 import re
-import six
 
 RE_COMMENT = re.compile(r'\s+#')
 RE_HTTP = re.compile(r'HTTP\((\.\.(\/\.\.)*)\)')
 RE_PROTOCOL = re.compile(r'^\w+:')
 FAILURE_TYPES = (
     'fails',
     'fails-if',
     'needs-focus',
@@ -92,24 +91,24 @@ class ReftestManifest(object):
             self.path = normalized_path
 
         mdir = os.path.dirname(normalized_path)
         self.dirs.add(mdir)
 
         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('#'):
                 continue
 
             # Comments can begin mid line. Strip them.
             m = RE_COMMENT.search(line)
             if m:
--- a/mobile/android/geckoview/src/androidTest/assets/moz.build
+++ b/mobile/android/geckoview/src/androidTest/assets/moz.build
@@ -14,11 +14,12 @@ addons = [
 ]
 
 for addon in addons:
     indir = 'web_extensions/%s' % addon
     xpi = '%s.xpi' % indir
 
     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]
--- a/moz.build
+++ b/moz.build
@@ -159,16 +159,17 @@ if not CONFIG['JS_STANDALONE'] or not CO
 
     GENERATED_FILES += [
         'buildid.h',
         'source-repo.h',
     ]
 
     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',
     ]
 
 DIRS += [
     'mfbt',
 ]
--- a/mozglue/build/Makefile.in
+++ b/mozglue/build/Makefile.in
@@ -3,17 +3,17 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # For FORCE_SHARED_LIB
 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
 
 # Rebuild mozglue.dll if the manifest changes - it's included by mozglue.rc.
 # (this dependency should really be just for mozglue.dll, not other targets)
 # Note the manifest file exists in the tree, so we use the explicit filename
 # here.
 EXTRA_DEPS += $(srcdir)/mozglue.dll.manifest
--- a/mozglue/dllservices/gen_dll_blocklist_defs.py
+++ b/mozglue/dllservices/gen_dll_blocklist_defs.py
@@ -273,17 +273,19 @@ class BlocklistDescriptor(object):
         # There should be no dupes in the input. If there are, raise an error.
         self.ensure_no_dupes(unified_list)
 
         # Now we filter out any unwanted list entries
         filtered_list = filter(filter_func, unified_list)
 
         # 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):
         """If BlocklistDescriptor.ExistingFd corresponds to outspec_leaf_name,
         then we return that. Otherwise, we construct a new absolute path to
         outspec_leaf_name and open a new file descriptor for writing.
         """
         if (not BlocklistDescriptor.ExistingFd or
@@ -364,17 +366,21 @@ GENERATED_BLOCKLIST_FILES = [
     # BlocklistDescriptor('LSP', ALL_DEFINITION_LISTS, outspec=LSP_OUTPUT_SPEC),
     BlocklistDescriptor('Test', ALL_DEFINITION_LISTS,
                         outspec={'filter': FILTER_TESTS_ONLY}),
 ]
 
 
 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
 
     def __str__(self):
         return '0x%08XU' % self._value
 
 
@@ -402,17 +408,17 @@ class Version(object):
         if len(args) == 1:
             if isinstance(args[0], tuple):
                 self.validate_iterable(args[0])
 
                 self._ver = 'MAKE_VERSION%r' % (args[0],)
             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)
 
             self._ver = 'MAKE_VERSION%r' % (tuple(args),)
         else:
             raise ValueError('Bad arguments to Version constructor')
 
     def validate_iterable(self, arg):
@@ -422,24 +428,24 @@ class Version(object):
         for component in arg:
             if (not isinstance(component, int) or component < 0
                 or component > 0xFFFF):
                 raise ValueError('Each version component must be a 16-bit '
                                  'unsigned integer')
 
     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'
 
             if self._ver == Version.UNVERSIONED:
                 return 'DllBlockInfo::UNVERSIONED'
 
             return '0x%016XULL' % self._ver
 
--- a/mozglue/dllservices/moz.build
+++ b/mozglue/dllservices/moz.build
@@ -48,11 +48,12 @@ blocklist_file_leaf_tpl = 'WindowsDllBlo
 blocklist_files = tuple([blocklist_file_leaf_tpl.format(type)
                          for type in blocklist_header_types])
 GENERATED_FILES += [
     blocklist_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'
--- a/netwerk/dns/prepare_tlds.py
+++ b/netwerk/dns/prepare_tlds.py
@@ -121,16 +121,18 @@ def main(output, effective_tld_filename,
     """
     make_dafsa expects lines of the form "<domain_name><enum_value>"
     """
     for etld in getEffectiveTLDs(effective_tld_filename):
       yield "%s%d" % (etld.domain(), typeEnum(etld))
 
   """ 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()))
 
 
 
 if __name__ == '__main__':
     """
--- a/netwerk/dns/tests/unit/data/moz.build
+++ b/netwerk/dns/tests/unit/data/moz.build
@@ -5,10 +5,11 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 GENERATED_FILES = ['fake_remote_dafsa.bin']
 
 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']
--- a/python/mozbuild/mozbuild/action/check_binary.py
+++ b/python/mozbuild/mozbuild/action/check_binary.py
@@ -51,17 +51,17 @@ else:
 
 get_type = memoize(get_type)
 
 
 @memoize
 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):
     pass
 
 
 class Empty(RuntimeError):
     pass
@@ -81,17 +81,17 @@ def at_least_one(iter):
 def iter_symbols(binary):
     ty = get_type(binary)
     # XXX: Static libraries on ELF, MACHO and COFF/PE systems are all
     # ar archives. So technically speaking, the following is wrong
     # but is enough for now. llvm-objdump -t can actually be used on all
     # 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'!<arch>\n':
+    if ty == UNKNOWN and open(binary).read(8) == '!<arch>\n':
         ty = ELF
     if ty in (ELF, MACHO):
         for line in get_output(buildconfig.substs['LLVM_OBJDUMP'], '-t',
                                binary):
             m = ADDR_RE.match(line)
             if not m:
                 continue
             addr = int(m.group(0), 16)
--- a/python/mozbuild/mozbuild/action/dumpsymbols.py
+++ b/python/mozbuild/mozbuild/action/dumpsymbols.py
@@ -75,18 +75,18 @@ def dump_symbols(target, tracking_file, 
             sym_store_args +
             ['-s', buildconfig.topsrcdir, dump_syms_bin, os.path.join(buildconfig.topobjdir,
                                                                       'dist',
                                                                       'crashreporter-symbols'),
              os.path.abspath(target)])
     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()
 
 
 def main(argv):
     parser = argparse.ArgumentParser(
         usage="Usage: dumpsymbols.py <library or program> <tracking file>")
     parser.add_argument("--count-ctors",
--- a/python/mozbuild/mozbuild/action/fat_aar.py
+++ b/python/mozbuild/mozbuild/action/fat_aar.py
@@ -5,17 +5,16 @@
 '''
 Fetch and unpack architecture-specific Maven zips, verify cross-architecture
 compatibility, and ready inputs to an Android multi-architecture fat AAR build.
 '''
 
 from __future__ import absolute_import, unicode_literals, print_function
 
 import argparse
-import six
 import sys
 
 from collections import (
     defaultdict,
     OrderedDict,
 )
 from hashlib import sha1  # We don't need a strong hash to compare inputs.
 from zipfile import ZipFile
@@ -66,17 +65,17 @@ def fat_aar(distdir, aars_paths, no_proc
                 # and it's not worth working around, so we use Python's zip functionality
                 # instead.
                 z = ZipFile(BytesIO(fileobj.open().read()))
                 for r in z.namelist():
                     fingerprint = sha1(z.open(r).read()).hexdigest()
                     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)
 
             missing_arch_prefs.discard(path)
 
     # Some differences are allowed across the architecture-specific AARs.  We could allow-list
     # the actual content, but it's not necessary right now.
@@ -95,31 +94,31 @@ def fat_aar(distdir, aars_paths, no_proc
 
     not_allowed = OrderedDict()
 
     def format_diffs(ds):
         # Like '  armeabi-v7a, arm64-v8a -> XXX\n  x86, x86_64 -> YYY'.
         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
 
         if any(mozpath.match(p, pat) for pat in allow_pattern_list):
             print('Allowed: Path "{path}" has architecture-specific versions:\n{ds_repr}'.format(
                 path=p, ds_repr=format_diffs(ds)))
             continue
 
         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)))
 
     for missing in sorted(missing_arch_prefs):
         print('Disallowed: Inputs missing expected architecture-specific input: {missing}'.format(
             missing=missing))
 
     if not no_compatibility_check and (missing_arch_prefs or not_allowed):
--- a/python/mozbuild/mozbuild/action/generate_symbols_file.py
+++ b/python/mozbuild/mozbuild/action/generate_symbols_file.py
@@ -2,17 +2,17 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import argparse
 import buildconfig
 import os
-from io import StringIO
+from StringIO import StringIO
 from mozbuild.preprocessor import Preprocessor
 from mozbuild.util import DefinesAction
 
 
 def generate_symbols_file(output, *args):
     ''' '''
     parser = argparse.ArgumentParser()
     parser.add_argument('input')
--- a/python/mozbuild/mozbuild/action/process_define_files.py
+++ b/python/mozbuild/mozbuild/action/process_define_files.py
@@ -58,17 +58,17 @@ def process_define_file(output, input):
                             specially here."""
                             define = "#define {name} {val}".format(name=name, val=val)
                             if name in ('WINVER', '_WIN32_WINNT'):
                                 return '#if !defined({name})\n{define}\n#endif' \
                                     .format(name=name, define=define)
                             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':
                         if value and name in config.defines:
                             l = l[:m.start('value')] \
                                 + str(config.defines[name]) \
                                 + l[m.end('value'):]
                     elif cmd == 'undef':
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -1586,23 +1586,23 @@ class RecursiveMakeBackend(MakeBackend):
         top_level = mozpath.join(obj.install_target, 'chrome.manifest')
         if obj.path != top_level:
             args = [
                 mozpath.join('$(DEPTH)', top_level),
                 make_quote(shell_quote('manifest %s' %
                                        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)
 
     def _write_manifests(self, dest, manifests):
         man_dir = mozpath.join(self.environment.topobjdir, '_build_manifests',
                                dest)
 
@@ -1678,17 +1678,17 @@ class RecursiveMakeBackend(MakeBackend):
         sorted_nonstatic_ipdl_basenames = list()
         for source in sorted_nonstatic_ipdl_sources:
             basename = os.path.basename(source)
             sorted_nonstatic_ipdl_basenames.append(basename)
             rule = mk.create_rule([basename])
             rule.add_dependencies([source])
             rule.add_commands([
                 '$(RM) $@',
-                '$(call py3_action,preprocessor,$(DEFINES) $(ACDEFINES) '
+                '$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) '
                 '$< -o $@)'
             ])
 
         mk.add_statement('ALL_IPDLSRCS := %s %s' % (' '.join(sorted_nonstatic_ipdl_basenames),
                                                     ' '.join(sorted_static_ipdl_sources)))
 
         self._add_unified_build_rules(mk, unified_ipdl_cppsrcs_mapping,
                                       unified_files_makefile_variable='CPPSRCS')
@@ -1733,17 +1733,17 @@ class RecursiveMakeBackend(MakeBackend):
             # our makefiles it's not set early enough to be useful, so we use
             # WEBIDL_PP_DEPS, which has analagous content.
             rule.add_dependencies([source, '$(WEBIDL_PP_DEPS)'])
             rule.add_commands([
                 # Remove the file before writing so bindings that go from
                 # 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 $@)'
             ])
 
         self._add_unified_build_rules(mk,
                                       unified_source_mapping,
                                       unified_files_makefile_variable='unified_binding_cpp_files')
 
         webidls_mk = mozpath.join(bindings_dir, 'webidlsrcs.mk')
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -835,17 +835,17 @@ class TreeMetadataEmitter(LoggingMixin):
                     script = mozpath.join(
                         mozpath.dirname(mozpath.dirname(__file__)),
                         'action', 'generate_symbols_file.py')
                     defines = ()
                     if lib.defines:
                         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:
                     lib = self._rust_library(context, libname, static_args,
                                              is_gkrust=bool(context.get('IS_GKRUST')))
                 else:
                     lib = StaticLibrary(context, libname, **static_args)
                 self._libs[libname].append(lib)
@@ -1473,17 +1473,17 @@ class TreeMetadataEmitter(LoggingMixin):
         yield XPIDLModule(context, xpidl_module, context['XPIDL_SOURCES'])
 
     def _process_generated_files(self, context):
         for path in context['CONFIGURE_DEFINE_FILES']:
             script = mozpath.join(mozpath.dirname(mozpath.dirname(__file__)),
                                   '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 []
         if not (generated_files or localized_generated_files):
             return
 
         for (localized, gen) in ((False, generated_files), (True, localized_generated_files)):
             for f in gen:
--- a/python/mozbuild/mozbuild/frontend/gyp_reader.py
+++ b/python/mozbuild/mozbuild/frontend/gyp_reader.py
@@ -89,16 +89,17 @@ def handle_actions(actions, context, act
                 '<(INTERMEDIATE_DIR) not supported: %s'
                 % output
             )
         output = output[len(idir):]
         context['GENERATED_FILES'] += [output]
         g = context['GENERATED_FILES'][output]
         g.script = action_overrides[name]
         g.inputs = action['inputs']
+        g.py2 = True
 
 
 def handle_copies(copies, context):
     dist = '$PRODUCT_DIR/dist/'
     for copy in copies:
         dest = copy['destination']
         if not dest.startswith(dist):
             raise NotImplementedError(
--- a/python/mozbuild/mozbuild/generated_sources.py
+++ b/python/mozbuild/mozbuild/generated_sources.py
@@ -34,17 +34,17 @@ def get_generated_sources():
     Yield tuples of `(objdir-rel-path, file)` for generated source files
     in this objdir, where `file` is either an absolute path to the file or
     a `mozpack.File` instance.
     '''
     import buildconfig
 
     # 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)
     # Next, return all the files in $objdir/ipc/ipdl/_ipdlheaders.
     base = 'ipc/ipdl/_ipdlheaders'
     finder = FileFinder(mozpath.join(buildconfig.topobjdir, base))
     for p, f in finder.find('**/*.h'):
         yield mozpath.join(base, p), f
--- a/python/mozbuild/mozbuild/jar.py
+++ b/python/mozbuild/mozbuild/jar.py
@@ -44,17 +44,17 @@ class ZipEntry(object):
     def __init__(self, name, zipfile):
         self._zipfile = zipfile
         self._name = name
         self._inner = BytesIO()
 
     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):
         '''The close method writes the content back to the zip file.'''
 
         self._zipfile.writestr(self._name, self._inner.getvalue())
 
 
--- a/python/mozbuild/mozbuild/test/backend/test_build.py
+++ b/python/mozbuild/mozbuild/test/backend/test_build.py
@@ -21,17 +21,16 @@ from mozbuild.frontend.emitter import Tr
 from mozbuild.frontend.reader import BuildReader
 from mozbuild.util import ensureParentDir
 from mozpack.files import FileFinder
 from tempfile import mkdtemp
 
 
 BASE_SUBSTS = [
     ('PYTHON', mozpath.normsep(sys.executable)),
-    ('PYTHON3', mozpath.normsep(sys.executable)),
     ('MOZ_UI_LOCALE', 'en-US'),
 ]
 
 
 class TestBuild(unittest.TestCase):
     def setUp(self):
         self._old_env = dict(os.environ)
         os.environ.pop('MOZCONFIG', None)
--- a/security/generate_mapfile.py
+++ b/security/generate_mapfile.py
@@ -20,17 +20,17 @@
 import buildconfig
 
 
 def main(output, input):
     is_darwin = buildconfig.substs['OS_ARCH'] == 'Darwin'
     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 ';-'
             if not is_mingw and ';-' in line:
                 continue
             # On OS X, remove all lines containing ';+'
             if is_darwin and ';+' in line:
                 continue
--- a/testing/testsuite-targets.mk
+++ b/testing/testsuite-targets.mk
@@ -151,17 +151,17 @@ endif
 package-tests-prepare-dest:
 	$(NSINSTALL) -D $(test_archive_dir)
 
 download-wpt-manifest:
 	$(call py_action,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)
 endef
 
 $(foreach name,$(TEST_PKGS_TARGZ),$(eval $(call package_archive,$(name),tar.gz)))
 
 ifeq ($(MOZ_BUILD_APP),mobile/android)
--- a/toolkit/mozapps/extensions/moz.build
+++ b/toolkit/mozapps/extensions/moz.build
@@ -27,16 +27,17 @@ XPIDL_SOURCES += [
 ]
 
 XPIDL_MODULE = 'extensions'
 
 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']
 
     FINAL_TARGET_FILES.browser.chrome.browser.content.browser += [
         '!%s' % built_in_addons,
     ]
 elif CONFIG['MOZ_BUILD_APP'] == 'mobile/android':
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -37,17 +37,17 @@ stage-package: multilocale.txt locale-ma
 		$(MOZ_PKG_MANIFEST) '$(DIST)' '$(DIST)'/$(MOZ_PKG_DIR)$(if $(MOZ_PKG_MANIFEST),,$(_BINPATH)) \
 		$(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES)))
 ifdef RUN_FIND_DUPES
 	$(PYTHON3) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DEFINES) $(ACDEFINES) $(MOZ_PKG_DUPEFLAGS) $(DIST)/$(MOZ_PKG_DIR)
 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
 endif # MOZ_IS_COMM_TOPDIR
 ifdef MOZ_PACKAGE_JSSHELL
 	# Package JavaScript Shell
 	@echo 'Packaging JavaScript Shell...'
 	$(RM) $(PKG_JSSHELL)
@@ -206,24 +206,24 @@ else
 BASE_PATH:=@RESPATH@
 MULTILOCALE_DIR = $(DIST)/$(RESPATH)/res
 endif
 
 # This version of the target uses MOZ_CHROME_MULTILOCALE to build multilocale.txt
 # 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
 	printf '\n[multilocale]\n' > $@
 	printf '$(BASE_PATH)/res/multilocale.txt\n' >> $@
 	for LOCALE in $(ALL_LOCALES) ;\
 	do \
 	  for ENTRY in $(MOZ_CHROME_LOCALE_ENTRIES) ;\
--- a/toolkit/mozapps/installer/upload-files.mk
+++ b/toolkit/mozapps/installer/upload-files.mk
@@ -86,17 +86,17 @@ endif
 ifdef MOZ_CLANG_RT_ASAN_LIB_PATH
   JSSHELL_BINS += $(notdir $(MOZ_CLANG_RT_ASAN_LIB_PATH))
 endif
 
 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,
   # where backslashes get slurped in command-line arguments if a command is run
   # with a double-quote character. The command to packager.py happens to be one
   # of these commands, where double-quotes appear in certain ACDEFINES values.
   # This turns a jarlog path like "Z:\task..." into "Z:task", which fails.
   # Switching the backslashes for forward slashes works around the issue.
@@ -129,24 +129,24 @@ ifeq ($(MOZ_PKG_FORMAT),BZ2)
   else
     INNER_MAKE_PACKAGE 	= $(CREATE_FINAL_TAR) - $(MOZ_PKG_DIR) | bzip2 -vf > $(PACKAGE)
   endif
   INNER_UNMAKE_PACKAGE	= bunzip2 -c $(UNPACKAGE) | $(UNPACK_TAR)
 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
 ifeq ($(MOZ_PKG_FORMAT),RPM)
   PKG_SUFFIX  = .rpm
   MOZ_NUMERIC_APP_VERSION = $(shell echo $(MOZ_PKG_VERSION) | sed 's/[^0-9.].*//' )
   MOZ_RPM_RELEASE = $(shell echo $(MOZ_PKG_VERSION) | sed 's/[0-9.]*//' )
 
@@ -226,25 +226,25 @@ INNER_UNMAKE_PACKAGE = true
 endif
 
 ifeq ($(MOZ_PKG_FORMAT),DMG)
   PKG_SUFFIX	= .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)') \
         --volume-name '$(MOZ_APP_DISPLAYNAME)' \
         '$(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)') \
         $(UNPACKAGE) $(MOZ_PKG_DIR) \
         )
 endif
 
 MAKE_PACKAGE = $(INNER_MAKE_PACKAGE)
--- a/toolkit/mozapps/installer/windows/nsis/makensis.mk
+++ b/toolkit/mozapps/installer/windows/nsis/makensis.mk
@@ -93,17 +93,17 @@ HELPER_DEPS = $(GLOBAL_DEPS) \
 
 # For building the uninstaller during the application build so it can be
 # included for mar file generation.
 $(CONFIG_DIR)/helper.exe: $(HELPER_DEPS)
 	$(RM) -r $(CONFIG_DIR)
 	$(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) \
 	  $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(MOZILLA_DIR)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/Plugins/,$(CUSTOM_NSIS_PLUGINS)) $(CONFIG_DIR)
 	cd $(CONFIG_DIR) && $(call WINEWRAP,$(MAKENSISU)) $(MAKENSISU_FLAGS) uninstaller.nsi
 
@@ -112,17 +112,17 @@ uninstaller:: $(CONFIG_DIR)/helper.exe
 	cp $(CONFIG_DIR)/helper.exe $(DIST)/bin/uninstall
 
 ifdef MOZ_MAINTENANCE_SERVICE
 maintenanceservice_installer::
 	$(RM) -r $(CONFIG_DIR)
 	$(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) \
 	  $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(MOZILLA_DIR)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/Plugins/,$(CUSTOM_NSIS_PLUGINS)) $(CONFIG_DIR)
 	cd $(CONFIG_DIR) && $(call WINEWRAP,$(MAKENSISU)) $(MAKENSISU_FLAGS) maintenanceservice_installer.nsi
 	$(NSINSTALL) -D $(DIST)/bin/