Bug 1633016 - Remove a bunch of references to PYTHON(2) in Makefiles r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D72479
This commit is contained in:
Ricky Stewart 2020-04-30 15:25:22 +00:00
Родитель d990224458
Коммит bb4e86d85a
16 изменённых файлов: 51 добавлений и 49 удалений

Просмотреть файл

@ -220,7 +220,7 @@ endif
uploadsymbols:
ifdef MOZ_CRASHREPORTER
$(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
$(PYTHON3) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
endif
.PHONY: update-packaging

Просмотреть файл

@ -78,7 +78,7 @@ LPROJ := Contents/Resources/$(LPROJ_ROOT).lproj
clean clobber repackage::
$(RM) -r $(dist_dest)
MAC_BUNDLE_VERSION = $(shell $(PYTHON) $(srcdir)/macversion.py --version=$(MOZ_APP_VERSION) --buildid=$(DEPTH)/buildid.h)
MAC_BUNDLE_VERSION = $(shell $(PYTHON3) $(srcdir)/macversion.py --version=$(MOZ_APP_VERSION) --buildid=$(DEPTH)/buildid.h)
.PHONY: repackage
tools repackage:: $(DIST)/bin/$(MOZ_APP_NAME)

Просмотреть файл

@ -3,23 +3,24 @@
# 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
from __future__ import absolute_import, print_function, unicode_literals
import io
from optparse import OptionParser
import sys
import re
o = OptionParser()
o.add_option("--buildid", dest="buildid")
o.add_option("--version", dest="version")
o.add_option('--buildid', dest='buildid')
o.add_option('--version', dest='version')
(options, args) = o.parse_args()
if not options.buildid:
print >>sys.stderr, "--buildid is required"
print('--buildid is required', file=sys.stderr)
sys.exit(1)
if not options.version:
print >>sys.stderr, "--version is required"
print('--version is required', file=sys.stderr)
sys.exit(1)
# We want to build a version number that matches the format allowed for
@ -28,7 +29,8 @@ if not options.version:
# builds), but also so that newly-built older versions (e.g. beta build) aren't
# considered "newer" than previously-built newer versions (e.g. a trunk nightly)
define, MOZ_BUILDID, buildid = open(options.buildid, 'r').read().split()
define, MOZ_BUILDID, buildid = io.open(
options.buildid, 'r', encoding='utf-8').read().split()
# extract only the major version (i.e. "14" from "14.0b1")
majorVersion = re.match(r'^(\d+)[^\d].*', options.version).group(1)

Просмотреть файл

@ -62,14 +62,14 @@ $(CONFIG_DIR)/setup.exe::
$(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR)
$(call py3_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 \
$(PYTHON3) $(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 \
$(PYTHON3) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
--preprocess-single-file $(topsrcdir) \
$(PPL_LOCALE_ARGS) $(CONFIG_DIR) \
nsisstrings.properties nsisstrings.nlf
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
$(PYTHON3) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
--convert-utf8-utf16le \
$(srcdir)/nsis/extensionsLocale.nsh $(CONFIG_DIR)/extensionsLocale.nsh

Просмотреть файл

@ -146,8 +146,8 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$DEVELOPER_OPTIONS"; then
if AC_TRY_COMMAND([${CC-cc} -o conftest.${ac_objext} $CFLAGS $MOZ_DEBUG_FLAGS -c conftest.${ac_ext} 1>&2]) &&
AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS $MOZ_DEBUG_FLAGS -Wl,--gc-sections conftest.${ac_objext} $LIBS 1>&2]) &&
test -s conftest${ac_exeext} -a -s conftest.${ac_objext}; then
if test "`$PYTHON -m mozbuild.configure.check_debug_ranges conftest.${ac_objext} conftest.${ac_ext}`" = \
"`$PYTHON -m mozbuild.configure.check_debug_ranges conftest${ac_exeext} conftest.${ac_ext}`"; then
if test "`$PYTHON3 -m mozbuild.configure.check_debug_ranges conftest.${ac_objext} conftest.${ac_ext}`" = \
"`$PYTHON3 -m mozbuild.configure.check_debug_ranges conftest${ac_exeext} conftest.${ac_ext}`"; then
GC_SECTIONS_BREAKS_DEBUG_RANGES=no
else
GC_SECTIONS_BREAKS_DEBUG_RANGES=yes

Просмотреть файл

@ -92,7 +92,7 @@ AUTOMATION_EXTRA_CMDLINE-check = --keep-going
# However, the target automation/buildsymbols will still be executed in this
# case because it is a prerequisite of automation/upload.
define automation_commands
@+$(PYTHON) $(topsrcdir)/config/run-and-prefix.py $1 $(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1)
@+$(PYTHON3) $(topsrcdir)/config/run-and-prefix.py $1 $(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1)
$(call BUILDSTATUS,TIER_FINISH $1)
endef

Просмотреть файл

@ -32,7 +32,7 @@ ifeq "$(CWD)" "/"
CWD := /.
endif
PYTHON ?= $(shell which python2.7 > /dev/null 2>&1 && echo python2.7 || echo python)
PYTHON3 ?= python3
####################################
# Load mozconfig Options
@ -46,7 +46,7 @@ endif
# Automatically add -jN to make flags if not defined. N defaults to number of cores.
ifeq (,$(findstring -j,$(MOZ_MAKE_FLAGS)))
cores=$(shell $(PYTHON) -c 'import multiprocessing; print(multiprocessing.cpu_count())')
cores=$(shell $(PYTHON3) -c 'import multiprocessing; print(multiprocessing.cpu_count())')
MOZ_MAKE_FLAGS += -j$(cores)
endif

Просмотреть файл

@ -9,8 +9,7 @@
# JSErrorFormatString.format member should be in ASCII encoding.
# ----------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import print_function
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys

Просмотреть файл

@ -2,8 +2,7 @@
# 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
from __future__ import print_function
from __future__ import absolute_import, print_function, unicode_literals
import os
import errno

Просмотреть файл

@ -28,7 +28,7 @@ USE_AUTOTARGETS_MK = 1
include $(MOZILLA_DIR)/config/makefiles/makeutils.mk
ifdef REBUILD_CHECK
REPORT_BUILD = $(info $(shell $(PYTHON) $(MOZILLA_DIR)/config/rebuild_check.py $@ $^))
REPORT_BUILD = $(info $(shell $(PYTHON3) $(MOZILLA_DIR)/config/rebuild_check.py $@ $^))
REPORT_BUILD_VERBOSE = $(REPORT_BUILD)
else
REPORT_BUILD = $(info $(relativesrcdir)/$(notdir $@))
@ -66,10 +66,10 @@ INSTALL_TARGETS += CPP_UNIT_TESTS
endif
run-cppunittests::
@$(PYTHON) $(MOZILLA_DIR)/testing/runcppunittests.py --xre-path=$(DIST)/bin --symbols-path=$(DIST)/crashreporter-symbols $(CPP_UNIT_TESTS)
@$(PYTHON3) $(MOZILLA_DIR)/testing/runcppunittests.py --xre-path=$(DIST)/bin --symbols-path=$(DIST)/crashreporter-symbols $(CPP_UNIT_TESTS)
cppunittests-remote:
$(PYTHON) -u $(MOZILLA_DIR)/testing/remotecppunittests.py \
$(PYTHON3) -u $(MOZILLA_DIR)/testing/remotecppunittests.py \
--xre-path=$(DEPTH)/dist/bin \
--localLib=$(DEPTH)/dist/$(MOZ_APP_NAME) \
--deviceIP=${TEST_DEVICE} \

Просмотреть файл

@ -6,23 +6,22 @@
# This script runs a process and prefixes its output with.
# Usage: run-and-prefix.py prefix command arg0 argv1...
from __future__ import absolute_import, print_function
from __future__ import absolute_import, print_function, unicode_literals
import os
import subprocess
import sys
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
sys.stderr = os.fdopen(sys.stderr.fileno(), 'w', 0)
sys.stdout = os.fdopen(sys.stdout.fileno(), 'wb', 0)
sys.stderr = os.fdopen(sys.stderr.fileno(), 'wb', 0)
prefix = sys.argv[1]
prefix = sys.argv[1].encode('utf-8')
args = sys.argv[2:]
p = subprocess.Popen(args, bufsize=0,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
stdin=sys.stdin.fileno(),
universal_newlines=True)
stdin=sys.stdin.fileno())
while True:
data = p.stdout.readline()
@ -30,6 +29,6 @@ while True:
if data == b'':
break
print('%s> %s' % (prefix, data), end=b'')
sys.stdout.write(b'%s> %s' % (prefix, data))
sys.exit(p.wait())

Просмотреть файл

@ -32,13 +32,13 @@ check:: $(srcdir)/replay.log expected_output.log $(srcdir)/expected_output_minim
# command in replay.log) because starting with libstdc++ 5, a static
# initializer in the STL allocates memory, which we obviously don't have
# in expected_output.log.
MALLOC_LOG=1 $(LOGALLOC) ./$(PROGRAM) < $< | sed -n '/jemalloc_stats/,$$p' | $(PYTHON) $(srcdir)/logalloc_munge.py | diff -w - expected_output.log
MALLOC_LOG=1 $(LOGALLOC) ./$(PROGRAM) < $< | sed -n '/jemalloc_stats/,$$p' | $(PYTHON3) $(srcdir)/logalloc_munge.py | diff -w - expected_output.log
# Test with MALLOC_LOG as a file name
$(RM) test_output.log
MALLOC_LOG=test_output.log $(LOGALLOC) ./$(PROGRAM) < $<
sed -n '/jemalloc_stats/,$$p' test_output.log | $(PYTHON) $(srcdir)/logalloc_munge.py | diff -w - expected_output.log
sed -n '/jemalloc_stats/,$$p' test_output.log | $(PYTHON3) $(srcdir)/logalloc_munge.py | diff -w - expected_output.log
MALLOC_LOG=1 MALLOC_LOG_MINIMAL=1 $(LOGALLOC) ./$(PROGRAM) < $< | sed -n '/jemalloc_stats/,$$p' | $(PYTHON) $(srcdir)/logalloc_munge.py | diff -w - $(srcdir)/expected_output_minimal.log
MALLOC_LOG=1 MALLOC_LOG_MINIMAL=1 $(LOGALLOC) ./$(PROGRAM) < $< | sed -n '/jemalloc_stats/,$$p' | $(PYTHON3) $(srcdir)/logalloc_munge.py | diff -w - $(srcdir)/expected_output_minimal.log
endif
endif

Просмотреть файл

@ -6,7 +6,7 @@
# to a given compilation unit. This is used as a helper to find a bug in some
# versions of GNU ld.
from __future__ import absolute_import, print_function
from __future__ import absolute_import, print_function, unicode_literals
import subprocess
import sys
@ -46,7 +46,8 @@ def get_range_length(range, debug_ranges):
def main(bin, compilation_unit):
p = subprocess.Popen(['objdump', '-W', bin], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = subprocess.Popen(['objdump', '-W', bin], stdout=subprocess.PIPE,
stderr=subprocess.PIPE, universal_newlines=True)
(out, err) = p.communicate()
sections = re.split('\n(Contents of the|The section) ', out)
debug_info = [s for s in sections if s.startswith('.debug_info')]

Просмотреть файл

@ -72,7 +72,7 @@ if CONFIG['MOZ_BUILD_APP'].startswith('comm/'):
# We run shlibsign as part of packaging, not build.
gyp_vars['sign_libs'] = 0
gyp_vars['python'] = CONFIG['PYTHON']
gyp_vars['python'] = CONFIG['PYTHON3']
# The NSS gyp files do not have a default for this.
gyp_vars['nss_dist_dir'] = '$PRODUCT_DIR/dist'
# NSS wants to put public headers in $nss_dist_dir/public/nss by default,

Просмотреть файл

@ -101,7 +101,7 @@ $(CONFIG_DIR)/helper.exe: $(HELPER_DEPS)
$(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR)
$(call py3_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 \
$(PYTHON3) $(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)
@ -120,7 +120,7 @@ maintenanceservice_installer::
$(INSTALL) $(addprefix $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/,$(BRANDING_FILES)) $(CONFIG_DIR)
$(call py3_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 \
$(PYTHON3) $(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)

Просмотреть файл

@ -12,7 +12,9 @@
# --convert-utf8-utf16le.
from codecs import BOM_UTF16_LE
import io
from os.path import join, isfile
import six
import sys
from optparse import OptionParser
@ -20,7 +22,7 @@ def open_utf16le_file(path):
"""
Returns an opened file object with a a UTF-16LE byte order mark.
"""
fp = open(path, "w+b")
fp = io.open(path, "w+b")
fp.write(BOM_UTF16_LE)
return fp
@ -37,7 +39,7 @@ def get_locale_strings(path, prefix, middle, add_cr):
linefeeds when there isn't one already
"""
output = ""
fp = open(path, "r")
fp = io.open(path, "r", encoding="utf-8")
for line in fp:
line = line.strip()
if line == "" or line[0] == "#":
@ -84,7 +86,7 @@ def preprocess_locale_files(config_dir, l10ndirs):
"LangString ^",
" 0 ",
False)
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
fp.write(locale_strings.encode("utf-16-le"))
fp.close()
# Create the Modern User Interface language file
@ -97,7 +99,7 @@ def preprocess_locale_files(config_dir, l10ndirs):
""").encode("utf-16-le"))
locale_strings = get_locale_strings(lookup("mui.properties", l10ndirs),
"!define ", " ", True)
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
fp.write(locale_strings.encode("utf-16-le"))
fp.write(u"!insertmacro MOZ_MUI_LANGUAGEFILE_END\n".encode("utf-16-le"))
fp.close()
@ -108,7 +110,7 @@ def preprocess_locale_files(config_dir, l10ndirs):
"LangString ",
" 0 ",
True)
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
fp.write(locale_strings.encode("utf-16-le"))
fp.close()
def create_nlf_file(moz_dir, ab_cd, config_dir):
@ -123,9 +125,9 @@ def create_nlf_file(moz_dir, ab_cd, config_dir):
rtl = "-"
# Check whether the locale is right to left from locales.nsi.
fp = open(join(moz_dir,
fp = io.open(join(moz_dir,
"toolkit/mozapps/installer/windows/nsis/locales.nsi"),
"r")
"r", encoding='utf-8')
for line in fp:
line = line.strip()
if line == "!define " + ab_cd + "_rtl":
@ -175,7 +177,7 @@ def preprocess_locale_file(config_dir,
"LangString ",
" 0 ",
True)
fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
fp.write(locale_strings.encode("utf-16-le"))
fp.close()
@ -187,9 +189,9 @@ def convert_utf8_utf16le(in_file_path, out_file_path):
in_file_path - the path to the UTF-8 source file to convert
out_file_path - the path to the UTF-16LE destination file to create
"""
in_fp = open(in_file_path, "r")
in_fp = open(in_file_path, "r", encoding='utf-8')
out_fp = open_utf16le_file(out_file_path)
out_fp.write(unicode(in_fp.read(), "utf-8").encode("utf-16-le"))
out_fp.write(in_fp.read().encode("utf-16-le"))
in_fp.close()
out_fp.close()