summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--patches/01_all_static_library_location.patch6
-rw-r--r--patches/02_all_disable_modules_and_ssl.patch10
-rw-r--r--patches/03_all_libdir.patch41
-rw-r--r--patches/04_all_non-zero_exit_status_on_failure.patch12
-rw-r--r--patches/05_all_regenerate_platform-specific_modules.patch123
-rw-r--r--patches/21_all_distutils_c++.patch2
-rw-r--r--patches/22_all_tests_environment.patch294
-rw-r--r--patches/23_all_h2py_encoding.patch16
-rw-r--r--patches/24_all_expat-2.2.patch19
9 files changed, 222 insertions, 301 deletions
diff --git a/patches/01_all_static_library_location.patch b/patches/01_all_static_library_location.patch
index 3180c73..ad799a3 100644
--- a/patches/01_all_static_library_location.patch
+++ b/patches/01_all_static_library_location.patch
@@ -4,7 +4,7 @@ https://bugs.python.org/issue6103
--- Makefile.pre.in
+++ Makefile.pre.in
-@@ -1061,6 +1061,19 @@
+@@ -1065,6 +1065,19 @@
$(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \
$$ensurepip --root=$(DESTDIR)/ ; \
fi
@@ -24,7 +24,7 @@ https://bugs.python.org/issue6103
commoninstall: @FRAMEWORKALTINSTALLFIRST@ \
altbininstall libinstall inclinstall libainstall \
-@@ -1398,18 +1411,6 @@
+@@ -1388,18 +1401,6 @@
else true; \
fi; \
done
@@ -82,7 +82,7 @@ https://bugs.python.org/issue6103
echo "$SO"
--- Modules/makesetup
+++ Modules/makesetup
-@@ -89,7 +89,7 @@
+@@ -90,7 +90,7 @@
then
ExtraLibDir=.
else
diff --git a/patches/02_all_disable_modules_and_ssl.patch b/patches/02_all_disable_modules_and_ssl.patch
index 6ad321a..8c419f7 100644
--- a/patches/02_all_disable_modules_and_ssl.patch
+++ b/patches/02_all_disable_modules_and_ssl.patch
@@ -1,6 +1,6 @@
--- setup.py
+++ setup.py
-@@ -44,7 +44,17 @@
+@@ -43,7 +43,17 @@
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
# This global variable is used to hold the list of modules to be disabled.
@@ -19,7 +19,7 @@
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (after any relative
-@@ -488,6 +498,7 @@
+@@ -487,6 +497,7 @@
return ['m']
def detect_modules(self):
@@ -27,7 +27,7 @@
# Ensure that /usr/local is always used, but the local build
# directories (i.e. '.' and 'Include') must be first. See issue
# 10520.
-@@ -815,7 +826,7 @@
+@@ -817,7 +828,7 @@
ssl_incs = find_file('openssl/ssl.h', inc_dirs,
search_for_ssl_incs_in
)
@@ -36,7 +36,7 @@
krb5_h = find_file('krb5.h', inc_dirs,
['/usr/kerberos/include'])
if krb5_h:
-@@ -826,7 +837,8 @@
+@@ -828,7 +839,8 @@
] )
if (ssl_incs is not None and
@@ -46,7 +46,7 @@
exts.append( Extension('_ssl', ['_ssl.c'],
include_dirs = ssl_incs,
library_dirs = ssl_libs,
-@@ -859,7 +871,7 @@
+@@ -861,7 +873,7 @@
#print('openssl_ver = 0x%08x' % openssl_ver)
min_openssl_ver = 0x00907000
diff --git a/patches/03_all_libdir.patch b/patches/03_all_libdir.patch
index 39a70c9..ecd1404 100644
--- a/patches/03_all_libdir.patch
+++ b/patches/03_all_libdir.patch
@@ -24,13 +24,13 @@
else:
--- Lib/site.py
+++ Lib/site.py
-@@ -303,7 +303,7 @@
+@@ -304,7 +304,7 @@
seen.add(prefix)
if os.sep == '/':
- sitepackages.append(os.path.join(prefix, "lib",
+ sitepackages.append(os.path.join(prefix, "@@GENTOO_LIBDIR@@",
- "python" + sys.version[:3],
+ "python%d.%d" % sys.version_info[:2],
"site-packages"))
else:
--- Lib/sysconfig.py
@@ -67,18 +67,18 @@
'data': '{userbase}',
--- Lib/test/test_site.py
+++ Lib/test/test_site.py
-@@ -249,7 +249,7 @@
+@@ -248,7 +248,7 @@
elif os.sep == '/':
# OS X non-framwework builds, Linux, FreeBSD, etc
self.assertEqual(len(dirs), 1)
-- wanted = os.path.join('xoxo', 'lib', 'python' + sys.version[:3],
-+ wanted = os.path.join('xoxo', '@@GENTOO_LIBDIR@@', 'python' + sys.version[:3],
+- wanted = os.path.join('xoxo', 'lib',
++ wanted = os.path.join('xoxo', '@@GENTOO_LIBDIR@@',
+ 'python%d.%d' % sys.version_info[:2],
'site-packages')
self.assertEqual(dirs[0], wanted)
- else:
--- Makefile.pre.in
+++ Makefile.pre.in
-@@ -125,7 +125,7 @@
+@@ -131,7 +131,7 @@
MANDIR= @mandir@
INCLUDEDIR= @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include
@@ -89,7 +89,7 @@
# Detailed destination directories
--- Modules/Setup.dist
+++ Modules/Setup.dist
-@@ -358,7 +358,7 @@
+@@ -362,7 +362,7 @@
# Andrew Kuchling's zlib module.
# This require zlib 1.1.3 (or later).
# See http://www.gzip.org/zlib/
@@ -129,18 +129,21 @@
--- configure.ac
+++ configure.ac
-@@ -4456,7 +4456,7 @@
-
+@@ -4601,9 +4601,9 @@
dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
AC_SUBST(PY_ENABLE_SHARED)
--LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
-+LIBPL='$(prefix)'"/@@GENTOO_LIBDIR@@/python${VERSION}/config-${LDVERSION}"
+ if test x$PLATFORM_TRIPLET = x; then
+- LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
++ LIBPL='$(prefix)'"/@@GENTOO_LIBDIR@@/python${VERSION}/config-${LDVERSION}"
+ else
+- LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
++ LIBPL='$(prefix)'"/@@GENTOO_LIBDIR@@/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+ fi
AC_SUBST(LIBPL)
- # Check whether right shifting a negative integer extends the sign bit
--- setup.py
+++ setup.py
-@@ -503,7 +503,7 @@
+@@ -502,7 +502,7 @@
# directories (i.e. '.' and 'Include') must be first. See issue
# 10520.
if not cross_compiling:
@@ -149,7 +152,7 @@
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
# only change this for cross builds for 3.3, issues on Mageia
if cross_compiling:
-@@ -560,8 +560,7 @@
+@@ -559,8 +559,7 @@
# be assumed that no additional -I,-L directives are needed.
if not cross_compiling:
lib_dirs = self.compiler.library_dirs + [
@@ -159,7 +162,7 @@
]
inc_dirs = self.compiler.include_dirs + ['/usr/include']
else:
-@@ -791,11 +790,11 @@
+@@ -793,11 +792,11 @@
elif curses_library:
readline_libs.append(curses_library)
elif self.compiler.find_library_file(lib_dirs +
@@ -173,7 +176,7 @@
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
else:
-@@ -1052,8 +1051,7 @@
+@@ -1077,8 +1076,7 @@
# check lib directories parallel to the location of the header
db_dirs_to_check = [
@@ -183,7 +186,7 @@
]
if host_platform != 'darwin':
-@@ -1164,10 +1162,8 @@
+@@ -1189,10 +1187,8 @@
if sqlite_incdir:
sqlite_dirs_to_check = [
@@ -196,7 +199,7 @@
]
sqlite_libfile = self.compiler.find_library_file(
sqlite_dirs_to_check + lib_dirs, 'sqlite3')
-@@ -1815,15 +1811,14 @@
+@@ -1840,15 +1836,14 @@
added_lib_dirs.append('/usr/openwin/lib')
elif os.path.exists('/usr/X11R6/include'):
include_dirs.append('/usr/X11R6/include')
diff --git a/patches/04_all_non-zero_exit_status_on_failure.patch b/patches/04_all_non-zero_exit_status_on_failure.patch
index 11667b9..f4e5875 100644
--- a/patches/04_all_non-zero_exit_status_on_failure.patch
+++ b/patches/04_all_non-zero_exit_status_on_failure.patch
@@ -3,7 +3,7 @@ https://bugs.python.org/issue6731
--- setup.py
+++ setup.py
-@@ -56,6 +56,8 @@
+@@ -55,6 +55,8 @@
else:
disable_ssl = 0
@@ -12,9 +12,9 @@ https://bugs.python.org/issue6731
def add_dir_to_list(dirlist, dir):
"""Add the directory 'dir' to the list 'dirlist' (after any relative
directories) if:
-@@ -313,7 +315,10 @@
- " detect_modules() for the module's name.")
- print()
+@@ -312,7 +314,10 @@
+ " Setup files:")
+ print_three_column([ext.name for ext in removed_modules])
+ global exit_status
+
@@ -23,7 +23,7 @@ https://bugs.python.org/issue6731
failed = self.failed[:]
print()
print("Failed to build these modules:")
-@@ -321,6 +326,7 @@
+@@ -320,6 +325,7 @@
print()
if self.failed_on_import:
@@ -31,7 +31,7 @@ https://bugs.python.org/issue6731
failed = self.failed_on_import[:]
print()
print("Following modules built successfully"
-@@ -2286,6 +2292,7 @@
+@@ -2308,6 +2314,7 @@
scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
"Tools/scripts/2to3", "Tools/scripts/pyvenv"]
)
diff --git a/patches/05_all_regenerate_platform-specific_modules.patch b/patches/05_all_regenerate_platform-specific_modules.patch
deleted file mode 100644
index 39329ad..0000000
--- a/patches/05_all_regenerate_platform-specific_modules.patch
+++ /dev/null
@@ -1,123 +0,0 @@
-https://bugs.python.org/issue12619
-
---- Lib/plat-aix4/regen
-+++ Lib/plat-aix4/regen
-@@ -5,4 +5,4 @@
- exit 1;;
- esac
- set -v
--h2py.py -i '(u_long)' /usr/include/netinet/in.h
-+python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
---- Lib/plat-linux/regen
-+++ Lib/plat-linux/regen
-@@ -5,4 +5,4 @@
- exit 1;;
- esac
- set -v
--h2py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/dlfcn.h
-+python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/dlfcn.h /usr/include/linux/cdrom.h
---- Lib/plat-sunos5/regen
-+++ Lib/plat-sunos5/regen
-@@ -5,5 +5,4 @@
- exit 1;;
- esac
- set -v
--h2py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/sys/stropts.h /usr/include/dlfcn.h
--
-+python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/sys/stropts.h /usr/include/dlfcn.h
---- Lib/plat-unixware7/regen
-+++ Lib/plat-unixware7/regen
-@@ -5,5 +5,5 @@
- exit 1;;
- esac
- set -v
--h2py -i '(u_long)' /usr/include/netinet/in.h
--h2py /usr/include/sys/stropts.h
-+python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h
-+python$EXE ../../Tools/scripts/h2py.py /usr/include/sys/stropts.h
---- Makefile.pre.in
-+++ Makefile.pre.in
-@@ -482,7 +482,7 @@
-
- # Default target
- all: build_all
--build_all: $(BUILDPYTHON) oldsharedmods sharedmods gdbhooks Programs/_testembed python-config
-+build_all: $(BUILDPYTHON) oldsharedmods sharedmods platformspecificmods gdbhooks Programs/_testembed python-config
-
- # Compile a binary with profile guided optimization.
- profile-opt:
-@@ -606,6 +606,32 @@
- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
-
-+# Build the platform-specific modules
-+platformspecificmods: $(BUILDPYTHON) sharedmods
-+ @PLATDIR=$(PLATDIR); \
-+ if test ! -f $(srcdir)/Lib/$(PLATDIR)/regen; then \
-+ $(INSTALL) -d $(srcdir)/Lib/$(PLATDIR); \
-+ if test -f $(srcdir)/Lib/$${PLATDIR%?}/regen; then \
-+ cp $(srcdir)/Lib/$${PLATDIR%?}/regen $(srcdir)/Lib/$(PLATDIR)/regen; \
-+ else \
-+ cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen; \
-+ fi \
-+ fi
-+ @EXE="$(BUILDEXE)"; export EXE; \
-+ PATH="`pwd`:$$PATH"; export PATH; \
-+ PYTHONPATH="`pwd`/Lib"; export PYTHONPATH; \
-+ if [ -n "$(MULTIARCH)" ]; then MULTIARCH=$(MULTIARCH); export MULTIARCH; fi; \
-+ if [ "$(BUILD_GNU_TYPE)" = "$(HOST_GNU_TYPE)" ]; then \
-+ PYTHON_FOR_BUILD="$(BUILDPYTHON)"; \
-+ else \
-+ PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)"; \
-+ fi; export PYTHON_FOR_BUILD; \
-+ cd $(srcdir)/Lib/$(PLATDIR); \
-+ $(RUNSHARED) ./regen || exit 1; \
-+ for module in *.py; do \
-+ $(RUNSHARED) $(BUILDPYTHON) -c "with open('$$module', 'rb') as module: compile(module.read(), '$$module', 'exec')" || exit 1; \
-+ done
-+
- # Build static library
- # avoid long command lines, same as LIBRARY_OBJS
- $(LIBRARY): $(LIBRARY_OBJS)
-@@ -1254,7 +1280,7 @@
- unittest unittest/test unittest/test/testmock \
- venv venv/scripts venv/scripts/posix \
- curses pydoc_data $(MACHDEPS)
--libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
-+libinstall: build_all $(srcdir)/Modules/xxmodule.c
- @for i in $(SCRIPTDIR) $(LIBDEST); \
- do \
- if test ! -d $(DESTDIR)$$i; then \
-@@ -1346,23 +1372,6 @@
- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
- $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
-
--# Create the PLATDIR source directory, if one wasn't distributed..
--$(srcdir)/Lib/$(PLATDIR):
-- mkdir $(srcdir)/Lib/$(PLATDIR)
-- cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
-- export PATH; PATH="`pwd`:$$PATH"; \
-- export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \
-- export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
-- export EXE; EXE="$(BUILDEXE)"; \
-- if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \
-- export PYTHON_FOR_BUILD; \
-- if [ "$(BUILD_GNU_TYPE)" = "$(HOST_GNU_TYPE)" ]; then \
-- PYTHON_FOR_BUILD="$(BUILDPYTHON)"; \
-- else \
-- PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)"; \
-- fi; \
-- cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
--
- python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
- # Substitution happens here, as the completely-expanded BINDIR
- # is not available in configure
-@@ -1691,7 +1700,7 @@
- Python/thread.o: @THREADHEADERS@
-
- # Declare targets that aren't real files
--.PHONY: all build_all sharedmods oldsharedmods test quicktest
-+.PHONY: all build_all sharedmods oldsharedmods platformspecificmods test quicktest
- .PHONY: install altinstall oldsharedinstall bininstall altbininstall
- .PHONY: maninstall libinstall inclinstall libainstall sharedinstall
- .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure
diff --git a/patches/21_all_distutils_c++.patch b/patches/21_all_distutils_c++.patch
index 877af24..cf1b173 100644
--- a/patches/21_all_distutils_c++.patch
+++ b/patches/21_all_distutils_c++.patch
@@ -229,7 +229,7 @@ https://bugs.python.org/issue1222585
linker = _osx_support.compiler_fixup(linker, ld_args)
--- Makefile.pre.in
+++ Makefile.pre.in
-@@ -602,7 +602,7 @@
+@@ -604,7 +604,7 @@
*\ -s*|s*) quiet="-q";; \
*) quiet="";; \
esac; \
diff --git a/patches/22_all_tests_environment.patch b/patches/22_all_tests_environment.patch
index 656f00b..4c01b1b 100644
--- a/patches/22_all_tests_environment.patch
+++ b/patches/22_all_tests_environment.patch
@@ -2,7 +2,7 @@ https://bugs.python.org/issue1674555
--- Lib/site.py
+++ Lib/site.py
-@@ -546,8 +546,12 @@
+@@ -527,8 +527,12 @@
known_paths = venv(known_paths)
if ENABLE_USER_SITE is None:
ENABLE_USER_SITE = check_enableusersite()
@@ -17,122 +17,182 @@ https://bugs.python.org/issue1674555
setquit()
setcopyright()
sethelper()
---- Lib/test/regrtest.py
-+++ Lib/test/regrtest.py
-@@ -143,6 +143,7 @@
- import unittest
- import warnings
- from inspect import isabstract
-+from subprocess import Popen, PIPE
+--- Lib/test/libregrtest/main.py
++++ Lib/test/libregrtest/main.py
+@@ -103,7 +103,7 @@
- try:
- import threading
-@@ -434,7 +435,6 @@
- subprocess exits, its return code, stdout and stderr are returned as a
- 3-tuple.
- """
-- from subprocess import Popen, PIPE
- base_cmd = ([sys.executable] + support.args_from_interpreter_flags() +
- ['-X', 'faulthandler', '-m', 'test.regrtest'])
- # required to spawn a new process with PGO flag on/off
-@@ -657,9 +657,62 @@
- support.use_resources = ns.use_resources
- save_modules = sys.modules.keys()
-
-+ def _runtest(test, verbose, quiet, huntrleaks=False, use_resources=None,
-+ output_on_failure=False, failfast=False, match_tests=None,
-+ timeout=None, *, pgo=False):
-+ if test == "test_site":
-+ base_cmd = ([sys.executable] + support.args_from_interpreter_flags() +
-+ ['-X', 'faulthandler', '-m', 'test.regrtest'])
-+ # required to spawn a new process with PGO flag on/off
-+ if pgo:
-+ base_cmd = base_cmd + ['--pgo']
-+ slaveargs = ((test, verbose, quiet),
-+ dict(huntrleaks=huntrleaks,
-+ use_resources=use_resources,
-+ output_on_failure=output_on_failure,
-+ timeout=timeout, failfast=failfast,
-+ match_tests=match_tests, pgo=pgo))
-+ env = os.environ.copy()
-+ try:
-+ del env["_PYTHONNOSITEPACKAGES"]
-+ except KeyError:
-+ pass
-+ popen = Popen(base_cmd + ['--slaveargs', json.dumps(slaveargs)],
-+ stdout=PIPE, stderr=PIPE,
-+ universal_newlines=True,
-+ close_fds=(os.name != 'nt'),
-+ cwd=support.SAVEDCWD,
-+ env=env)
-+ stdout, stderr = popen.communicate()
-+ retcode = popen.wait()
-+ stdout, _, result = stdout.strip().rpartition("\n")
-+ if retcode != 0:
-+ result = (CHILD_ERROR, None)
-+ else:
-+ if not result:
-+ return (None, None)
-+ result = json.loads(result)
-+ stdout = stdout.rstrip()
-+ stderr = stderr.rstrip()
-+ if stdout:
-+ print(stdout)
-+ if stderr and not pgo:
-+ print(stderr, file=sys.stderr)
-+ sys.stdout.flush()
-+ sys.stderr.flush()
-+ if result[0] == INTERRUPTED:
-+ raise KeyboardInterrupt
-+ return result
-+ else:
-+ return runtest(test, verbose, quiet, huntrleaks=huntrleaks,
-+ use_resources=use_resources,
-+ output_on_failure=output_on_failure,
-+ failfast=failfast, match_tests=match_tests,
-+ timeout=timeout, pgo=pgo)
-+
- def accumulate_result(test, result):
+ def accumulate_result(self, test, result):
ok, test_time = result
- if ok not in (CHILD_ERROR, INTERRUPTED):
+ if ok not in (None, CHILD_ERROR, INTERRUPTED):
- test_times.append((test_time, test))
+ self.test_times.append((test_time, test))
if ok == PASSED:
- good.append(test)
-@@ -773,15 +826,15 @@
- if ns.trace:
- # If we're tracing code coverage, then we don't exit with status
- # if on a false return value from main.
-- tracer.runctx('runtest(test, ns.verbose, ns.quiet, timeout=ns.timeout)',
-+ tracer.runctx('_runtest(test, ns.verbose, ns.quiet, timeout=ns.timeout)',
- globals=globals(), locals=vars())
- else:
- try:
-- result = runtest(test, ns.verbose, ns.quiet,
-- ns.huntrleaks,
-- output_on_failure=ns.verbose3,
-- timeout=ns.timeout, failfast=ns.failfast,
-- match_tests=ns.match_tests, pgo=ns.pgo)
-+ result = _runtest(test, ns.verbose, ns.quiet,
-+ ns.huntrleaks,
-+ output_on_failure=ns.verbose3,
-+ timeout=ns.timeout, failfast=ns.failfast,
-+ match_tests=ns.match_tests, pgo=ns.pgo)
- accumulate_result(test, result)
- except KeyboardInterrupt:
- interrupted = True
-@@ -835,8 +888,8 @@
- sys.stdout.flush()
- try:
- ns.verbose = True
-- ok = runtest(test, True, ns.quiet, ns.huntrleaks,
-- timeout=ns.timeout, pgo=ns.pgo)
-+ ok = _runtest(test, True, ns.quiet, ns.huntrleaks,
-+ timeout=ns.timeout, pgo=ns.pgo)
- except KeyboardInterrupt:
- # print a newline separate from the ^C
- print()
-@@ -1261,8 +1314,9 @@
+ self.good.append(test)
+--- Lib/test/libregrtest/runtest.py
++++ Lib/test/libregrtest/runtest.py
+@@ -1,6 +1,7 @@
+ import faulthandler
+ import importlib
+ import io
++import json
+ import os
+ import sys
+ import time
+@@ -71,7 +72,7 @@
+ return stdtests + sorted(tests)
+
+
+-def runtest(ns, test):
++def runtest(ns, test, *, slave=False):
+ """Run a single test.
+
+ ns -- regrtest namespace of options
+@@ -90,6 +91,25 @@
+
+ output_on_failure = ns.verbose3
+
++ if not slave and test == "test_site":
++ retcode, stdout, stderr = run_test_in_subprocess(test, ns)
++ stdout, _, result = stdout.strip().rpartition("\n")
++ if retcode != 0:
++ result = (CHILD_ERROR, None)
++ else:
++ if not result:
++ return (None, None)
++ result = json.loads(result)
++ stdout = stdout.rstrip()
++ stderr = stderr.rstrip()
++ if stdout:
++ print(stdout, flush=True)
++ if stderr and not ns.pgo:
++ print(stderr, file=sys.stderr, flush=True)
++ if result[0] == INTERRUPTED:
++ raise KeyboardInterrupt
++ return result
++
+ use_timeout = (ns.timeout is not None)
+ if use_timeout:
+ faulthandler.dump_traceback_later(ns.timeout, exit=True)
+@@ -135,6 +155,41 @@
+ runtest.stringio = None
+
+
++def run_test_in_subprocess(testname, ns):
++ """Run the given test in a subprocess with --slaveargs.
++
++ ns is the option Namespace parsed from command-line arguments. regrtest
++ is invoked in a subprocess with the --slaveargs argument; when the
++ subprocess exits, its return code, stdout and stderr are returned as a
++ 3-tuple.
++ """
++ from subprocess import Popen, PIPE
++
++ ns_dict = vars(ns)
++ slaveargs = (ns_dict, testname)
++ slaveargs = json.dumps(slaveargs)
++
++ cmd = [sys.executable, *support.args_from_interpreter_flags(),
++ '-X', 'faulthandler',
++ '-m', 'test.regrtest',
++ '--slaveargs', slaveargs]
++ if ns.pgo:
++ cmd += ['--pgo']
++
++ # Running the child from the same working directory as regrtest's original
++ # invocation ensures that TEMPDIR for the child is the same when
++ # sysconfig.is_python_build() is true. See issue 15300.
++ popen = Popen(cmd,
++ stdout=PIPE, stderr=PIPE,
++ universal_newlines=True,
++ close_fds=(os.name != 'nt'),
++ cwd=support.SAVEDCWD)
++ with popen:
++ stdout, stderr = popen.communicate()
++ retcode = popen.wait()
++ return retcode, stdout, stderr
++
++
+ def runtest_inner(ns, test, display_failure=True):
+ support.unload(test)
+
+--- Lib/test/libregrtest/runtest_mp.py
++++ Lib/test/libregrtest/runtest_mp.py
+@@ -1,12 +1,10 @@
+ import faulthandler
+ import json
+-import os
+ import queue
+ import sys
+ import time
+ import traceback
+ import types
+-from test import support
+ try:
+ import threading
+ except ImportError:
+@@ -14,7 +12,7 @@
+ sys.exit(2)
+
+ from test.libregrtest.runtest import (
+- runtest, INTERRUPTED, CHILD_ERROR, PROGRESS_MIN_TIME,
++ runtest, run_test_in_subprocess, INTERRUPTED, CHILD_ERROR, PROGRESS_MIN_TIME,
+ format_test_result)
+ from test.libregrtest.setup import setup_tests
+
+@@ -26,41 +24,6 @@
+ WAIT_PROGRESS = 2.0 # seconds
+
+
+-def run_test_in_subprocess(testname, ns):
+- """Run the given test in a subprocess with --slaveargs.
+-
+- ns is the option Namespace parsed from command-line arguments. regrtest
+- is invoked in a subprocess with the --slaveargs argument; when the
+- subprocess exits, its return code, stdout and stderr are returned as a
+- 3-tuple.
+- """
+- from subprocess import Popen, PIPE
+-
+- ns_dict = vars(ns)
+- slaveargs = (ns_dict, testname)
+- slaveargs = json.dumps(slaveargs)
+-
+- cmd = [sys.executable, *support.args_from_interpreter_flags(),
+- '-X', 'faulthandler',
+- '-m', 'test.regrtest',
+- '--slaveargs', slaveargs]
+- if ns.pgo:
+- cmd += ['--pgo']
+-
+- # Running the child from the same working directory as regrtest's original
+- # invocation ensures that TEMPDIR for the child is the same when
+- # sysconfig.is_python_build() is true. See issue 15300.
+- popen = Popen(cmd,
+- stdout=PIPE, stderr=PIPE,
+- universal_newlines=True,
+- close_fds=(os.name != 'nt'),
+- cwd=support.SAVEDCWD)
+- with popen:
+- stdout, stderr = popen.communicate()
+- retcode = popen.wait()
+- return retcode, stdout, stderr
+-
+-
+ def run_tests_slave(slaveargs):
+ ns_dict, testname = json.loads(slaveargs)
+ ns = types.SimpleNamespace(**ns_dict)
+@@ -68,7 +31,7 @@
+ setup_tests(ns)
+
+ try:
+- result = runtest(ns, testname)
++ result = runtest(ns, testname, slave=True)
+ except KeyboardInterrupt:
+ result = INTERRUPTED, ''
+ except BaseException as e:
+--- Lib/test/libregrtest/save_env.py
++++ Lib/test/libregrtest/save_env.py
+@@ -272,8 +272,9 @@
for name, get, restore in self.resource_info():
current = get()
original = saved_values.pop(name)
@@ -154,7 +214,7 @@ https://bugs.python.org/issue1674555
import os
import sys
import re
-@@ -26,6 +27,10 @@
+@@ -27,6 +28,10 @@
import site
@@ -175,16 +235,16 @@ https://bugs.python.org/issue1674555
'import sys; print(set(sys.modules))'],
+ env=env,
stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- stdout, stderr = popen.communicate()
+ stderr=subprocess.PIPE,
+ encoding='utf-8')
--- Makefile.pre.in
+++ Makefile.pre.in
-@@ -1016,7 +1016,7 @@
+@@ -994,7 +994,7 @@
######################################################################
TESTOPTS= $(EXTRATESTOPTS)
-TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS)
+TESTPYTHON= _PYTHONNOSITEPACKAGES=1 $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS)
TESTRUNNER= $(TESTPYTHON) $(srcdir)/Tools/scripts/run_tests.py
- TESTTIMEOUT= 3600
+ TESTTIMEOUT= 1200
diff --git a/patches/23_all_h2py_encoding.patch b/patches/23_all_h2py_encoding.patch
index f472b7c..abdb88b 100644
--- a/patches/23_all_h2py_encoding.patch
+++ b/patches/23_all_h2py_encoding.patch
@@ -6,17 +6,17 @@ https://bugs.python.org/issue13032
import sys, re, getopt, os
--p_define = re.compile('^[\t ]*#[\t ]*define[\t ]+([a-zA-Z0-9_]+)[\t ]+')
-+p_define = re.compile(b'^[\t ]*#[\t ]*define[\t ]+([a-zA-Z0-9_]+)[\t ]+')
+-p_define = re.compile(r'^[\t ]*#[\t ]*define[\t ]+([a-zA-Z0-9_]+)[\t ]+')
++p_define = re.compile(br'^[\t ]*#[\t ]*define[\t ]+([a-zA-Z0-9_]+)[\t ]+')
p_macro = re.compile(
-- '^[\t ]*#[\t ]*define[\t ]+'
-- '([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[\t ]+')
-+ b'^[\t ]*#[\t ]*define[\t ]+'
-+ b'([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[\t ]+')
+- r'^[\t ]*#[\t ]*define[\t ]+'
+- r'([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[\t ]+')
++ br'^[\t ]*#[\t ]*define[\t ]+'
++ br'([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[\t ]+')
--p_include = re.compile('^[\t ]*#[\t ]*include[\t ]+<([^>\n]+)>')
-+p_include = re.compile(b'^[\t ]*#[\t ]*include[\t ]+<([^>\n]+)>')
+-p_include = re.compile(r'^[\t ]*#[\t ]*include[\t ]+<([^>\n]+)>')
++p_include = re.compile(br'^[\t ]*#[\t ]*include[\t ]+<([^>\n]+)>')
-p_comment = re.compile(r'/\*([^*]+|\*+[^/])*(\*+/)?')
-p_cpp_comment = re.compile('//.*')
diff --git a/patches/24_all_expat-2.2.patch b/patches/24_all_expat-2.2.patch
deleted file mode 100644
index bd69580..0000000
--- a/patches/24_all_expat-2.2.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-https://bugs.python.org/issue27369
-https://hg.python.org/cpython/rev/0fbf3b88eed8
-
---- Lib/test/test_pyexpat.py
-+++ Lib/test/test_pyexpat.py
-@@ -656,11 +656,9 @@
- # \xc2\x85 is UTF-8 encoded U+0085 (NEXT LINE)
- xml = b"<?xml version\xc2\x85='1.0'?>\r\n"
- parser = expat.ParserCreate()
-- try:
-+ err_pattern = r'XML declaration not well-formed: line 1, column \d+'
-+ with self.assertRaisesRegex(expat.ExpatError, err_pattern):
- parser.Parse(xml, True)
-- self.fail()
-- except expat.ExpatError as e:
-- self.assertEqual(str(e), 'XML declaration not well-formed: line 1, column 14')
-
- class ErrorMessageTest(unittest.TestCase):
- def test_codes(self):