python3-3.8.12

This commit is contained in:
Rmys
2021-10-18 17:57:53 +03:00
committed by GitHub
parent c12c0674c5
commit 5ba99f476f
7 changed files with 748 additions and 2 deletions
+1
View File
@@ -56,3 +56,4 @@ def install():
pisitools.removeDir("/usr/lib/python3.8/tkinter")
pisitools.removeDir("/usr/lib/python3.8/turtledemo")
pisitools.remove("/usr/bin/idle3*")
pisitools.remove("/usr/lib/libpython3.8.a")
@@ -0,0 +1,81 @@
From cb8a5266fd6cef5f523f64f95905d684766c68de Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 5 Jan 2018 13:28:45 -0500
Subject: [PATCH 01/16] Install libpythonX.Y.a in /usr/lib instead of
/usr/lib/pythonX.Y/config
https://bugs.gentoo.org/show_bug.cgi?id=252372
https://bugs.python.org/issue6103
---
Makefile.pre.in | 4 ++--
Misc/python-config.in | 6 ------
Misc/python-config.sh.in | 6 +-----
Modules/makesetup | 2 +-
4 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 7e381283fe..37cbb02890 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1582,9 +1582,9 @@ libainstall: @DEF_MAKE_RULE@ python-config
@if test -d $(LIBRARY); then :; else \
if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
if test "$(SHLIB_SUFFIX)" = .dll; then \
- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
+ $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBDIR) ; \
else \
- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
+ $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBDIR)/$(LIBRARY) ; \
fi; \
else \
echo Skip install of $(LIBRARY) - use make frameworkinstall; \
diff --git a/Misc/python-config.in b/Misc/python-config.in
index 727c4a8682..bab60cf2d1 100644
--- a/Misc/python-config.in
+++ b/Misc/python-config.in
@@ -56,12 +56,6 @@ for opt in opt_flags:
if libpython:
libs.append(libpython)
libs.extend(getvar('LIBS').split() + getvar('SYSLIBS').split())
-
- # add the prefix/lib/pythonX.Y/config dir, but only if there is no
- # shared library in prefix/lib/.
- if opt == '--ldflags':
- if not getvar('Py_ENABLE_SHARED'):
- libs.insert(0, '-L' + getvar('LIBPL'))
print(' '.join(libs))
elif opt == '--extension-suffix':
diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
index 2602fe24c0..8ef19cade3 100644
--- a/Misc/python-config.sh.in
+++ b/Misc/python-config.sh.in
@@ -97,11 +97,7 @@ do
echo "$LIBS"
;;
--ldflags)
- LIBPLUSED=
- if [ "$PY_ENABLE_SHARED" = "0" ] ; then
- LIBPLUSED="-L$LIBPL"
- fi
- echo "$LIBPLUSED -L$libdir $LIBS"
+ echo "-L$libdir $LIBS"
;;
--extension-suffix)
echo "$SO"
diff --git a/Modules/makesetup b/Modules/makesetup
index fefe3fd129..ec7f2c098b 100755
--- a/Modules/makesetup
+++ b/Modules/makesetup
@@ -92,7 +92,7 @@ CYGWIN*) if test $libdir = .
then
ExtraLibDir=.
else
- ExtraLibDir='$(LIBPL)'
+ ExtraLibDir='$(LIBDIR)'
fi
ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)";;
esac
--
2.33.0
@@ -0,0 +1,53 @@
From dbb695267eb05999d2af3ce85200c3ebdf53b1e5 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 5 Jan 2018 13:32:45 -0500
Subject: [PATCH 04/16] setup.py: exit with non-zero status on failure
https://bugs.gentoo.org/show_bug.cgi?id=281968
https://bugs.python.org/issue6731
---
setup.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/setup.py b/setup.py
index 53591bc1e6..2b362029ac 100644
--- a/setup.py
+++ b/setup.py
@@ -86,6 +86,7 @@ Programming Language :: Python
Topic :: Software Development
"""
+exit_status = 0
# Set common compiler and linker flags derived from the Makefile,
# reserved for building the interpreter and the stdlib modules.
@@ -430,7 +431,10 @@ class PyBuildExt(build_ext):
print_three_column([ext.name for ext in mods_disabled])
print()
+ global exit_status
+
if self.failed:
+ exit_status = 1
failed = self.failed[:]
print()
print("Failed to build these modules:")
@@ -438,6 +442,7 @@ class PyBuildExt(build_ext):
print()
if self.failed_on_import:
+ exit_status = 1
failed = self.failed_on_import[:]
print()
print("Following modules built successfully"
@@ -2415,6 +2420,7 @@ def main():
scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
"Tools/scripts/2to3"]
)
+ sys.exit(exit_status)
# --install-platlib
if __name__ == '__main__':
--
2.33.0
@@ -0,0 +1,333 @@
From 5082bf6ec57eed8680eac679f6c3e6908031b3f7 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 5 Jan 2018 13:34:21 -0500
Subject: [PATCH 05/16] Improve distutils C++ support
https://bugs.python.org/issue1222585
---
Lib/_osx_support.py | 6 +--
Lib/distutils/cygwinccompiler.py | 21 ++++++++--
Lib/distutils/sysconfig.py | 25 ++++++++---
Lib/distutils/tests/test_sysconfig.py | 16 +++----
Lib/distutils/unixccompiler.py | 60 +++++++++++++--------------
Makefile.pre.in | 4 +-
6 files changed, 80 insertions(+), 52 deletions(-)
diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py
index 9b127c2491..b13734a271 100644
--- a/Lib/_osx_support.py
+++ b/Lib/_osx_support.py
@@ -14,13 +14,13 @@ __all__ = [
# configuration variables that may contain universal build flags,
# like "-arch" or "-isdkroot", that may need customization for
# the user environment
-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
+_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
+ 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX',
'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
'PY_CORE_CFLAGS', 'PY_CORE_LDFLAGS')
# configuration variables that may contain compiler calls
-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX')
+_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX')
# prefix added to original configuration variable names
_INITPRE = '_OSX_SUPPORT_INITIAL_'
diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py
index 6c5d77746b..640fa2da34 100644
--- a/Lib/distutils/cygwinccompiler.py
+++ b/Lib/distutils/cygwinccompiler.py
@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler):
# dllwrap 2.10.90 is buggy
if self.ld_version >= "2.10.90":
self.linker_dll = "gcc"
+ self.linker_dll_cxx = "g++"
else:
self.linker_dll = "dllwrap"
+ self.linker_dll_cxx = "dllwrap"
# ld_version >= "2.13" support -shared so use it instead of
# -mdll -static
@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler):
self.set_executables(compiler='gcc -mcygwin -O -Wall',
compiler_so='gcc -mcygwin -mdll -O -Wall',
compiler_cxx='g++ -mcygwin -O -Wall',
+ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
linker_exe='gcc -mcygwin',
linker_so=('%s -mcygwin %s' %
- (self.linker_dll, shared_option)))
+ (self.linker_dll, shared_option)),
+ linker_exe_cxx='g++ -mcygwin',
+ linker_so_cxx=('%s -mcygwin %s' %
+ (self.linker_dll_cxx, shared_option)))
# cygwin and mingw32 need different sets of libraries
if self.gcc_version == "2.91.57":
@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler):
raise CompileError(msg)
else: # for other files use the C-compiler
try:
- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
- extra_postargs)
+ if self.detect_language(src) == 'c++':
+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
+ extra_postargs)
+ else:
+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+ extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler):
self.set_executables(compiler='gcc -O -Wall',
compiler_so='gcc -mdll -O -Wall',
compiler_cxx='g++ -O -Wall',
+ compiler_so_cxx='g++ -mdll -O -Wall',
linker_exe='gcc',
linker_so='%s %s %s'
% (self.linker_dll, shared_option,
+ entry_point),
+ linker_exe_cxx='g++',
+ linker_so_cxx='%s %s %s'
+ % (self.linker_dll_cxx, shared_option,
entry_point))
# Maybe we should also append -mthreads, but then the finished
# dlls need another dll (mingwm10.dll see Mingw32 docs)
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index b51629eb94..c00870fb0f 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -187,9 +187,12 @@ def customize_compiler(compiler):
_osx_support.customize_compiler(_config_vars)
_config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
- (cc, cxx, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
- get_config_vars('CC', 'CXX', 'CFLAGS',
- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
+ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
+ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
+ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
+
+ cflags = ''
+ cxxflags = ''
if 'CC' in os.environ:
newcc = os.environ['CC']
@@ -204,19 +207,27 @@ def customize_compiler(compiler):
cxx = os.environ['CXX']
if 'LDSHARED' in os.environ:
ldshared = os.environ['LDSHARED']
+ if 'LDCXXSHARED' in os.environ:
+ ldcxxshared = os.environ['LDCXXSHARED']
if 'CPP' in os.environ:
cpp = os.environ['CPP']
else:
cpp = cc + " -E" # not always
if 'LDFLAGS' in os.environ:
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
+ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
if 'CFLAGS' in os.environ:
- cflags = cflags + ' ' + os.environ['CFLAGS']
+ cflags = os.environ['CFLAGS']
ldshared = ldshared + ' ' + os.environ['CFLAGS']
+ if 'CXXFLAGS' in os.environ:
+ cxxflags = os.environ['CXXFLAGS']
+ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
if 'CPPFLAGS' in os.environ:
cpp = cpp + ' ' + os.environ['CPPFLAGS']
cflags = cflags + ' ' + os.environ['CPPFLAGS']
+ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
+ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
if 'AR' in os.environ:
ar = os.environ['AR']
if 'ARFLAGS' in os.environ:
@@ -225,13 +236,17 @@ def customize_compiler(compiler):
archiver = ar + ' ' + ar_flags
cc_cmd = cc + ' ' + cflags
+ cxx_cmd = cxx + ' ' + cxxflags
compiler.set_executables(
preprocessor=cpp,
compiler=cc_cmd,
compiler_so=cc_cmd + ' ' + ccshared,
- compiler_cxx=cxx,
+ compiler_cxx=cxx_cmd,
+ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
linker_so=ldshared,
linker_exe=cc,
+ linker_so_cxx=ldcxxshared,
+ linker_exe_cxx=cxx,
archiver=archiver)
compiler.shared_lib_extension = shlib_suffix
diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py
index 236755d095..1388728963 100644
--- a/Lib/distutils/tests/test_sysconfig.py
+++ b/Lib/distutils/tests/test_sysconfig.py
@@ -114,12 +114,13 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
os.environ['AR'] = 'env_ar'
os.environ['CC'] = 'env_cc'
os.environ['CPP'] = 'env_cpp'
- os.environ['CXX'] = 'env_cxx --env-cxx-flags'
+ os.environ['CXX'] = 'env_cxx'
os.environ['LDSHARED'] = 'env_ldshared'
os.environ['LDFLAGS'] = '--env-ldflags'
os.environ['ARFLAGS'] = '--env-arflags'
os.environ['CFLAGS'] = '--env-cflags'
os.environ['CPPFLAGS'] = '--env-cppflags'
+ os.environ['CXXFLAGS'] = '--env-cxxflags'
comp = self.customize_compiler()
self.assertEqual(comp.exes['archiver'],
@@ -127,12 +128,12 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
self.assertEqual(comp.exes['preprocessor'],
'env_cpp --env-cppflags')
self.assertEqual(comp.exes['compiler'],
- 'env_cc --sc-cflags --env-cflags --env-cppflags')
+ 'env_cc --env-cflags --env-cppflags')
self.assertEqual(comp.exes['compiler_so'],
- ('env_cc --sc-cflags '
+ ('env_cc '
'--env-cflags ''--env-cppflags --sc-ccshared'))
self.assertEqual(comp.exes['compiler_cxx'],
- 'env_cxx --env-cxx-flags')
+ 'env_cxx --env-cxxflags --env-cppflags')
self.assertEqual(comp.exes['linker_exe'],
'env_cc')
self.assertEqual(comp.exes['linker_so'],
@@ -149,6 +150,7 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
del os.environ['ARFLAGS']
del os.environ['CFLAGS']
del os.environ['CPPFLAGS']
+ del os.environ['CXXFLAGS']
comp = self.customize_compiler()
self.assertEqual(comp.exes['archiver'],
@@ -156,11 +158,11 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
self.assertEqual(comp.exes['preprocessor'],
'sc_cc -E')
self.assertEqual(comp.exes['compiler'],
- 'sc_cc --sc-cflags')
+ 'sc_cc ')
self.assertEqual(comp.exes['compiler_so'],
- 'sc_cc --sc-cflags --sc-ccshared')
+ 'sc_cc --sc-ccshared')
self.assertEqual(comp.exes['compiler_cxx'],
- 'sc_cxx')
+ 'sc_cxx ')
self.assertEqual(comp.exes['linker_exe'],
'sc_cc')
self.assertEqual(comp.exes['linker_so'],
diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index f0792de74a..16e7fbea83 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler):
# are pretty generic; they will probably have to be set by an outsider
# (eg. using information discovered by the sysconfig about building
# Python extensions).
- executables = {'preprocessor' : None,
- 'compiler' : ["cc"],
- 'compiler_so' : ["cc"],
- 'compiler_cxx' : ["cc"],
- 'linker_so' : ["cc", "-shared"],
- 'linker_exe' : ["cc"],
- 'archiver' : ["ar", "-cr"],
- 'ranlib' : None,
+ executables = {'preprocessor' : None,
+ 'compiler' : ["cc"],
+ 'compiler_so' : ["cc"],
+ 'compiler_cxx' : ["c++"],
+ 'compiler_so_cxx' : ["c++"],
+ 'linker_so' : ["cc", "-shared"],
+ 'linker_exe' : ["cc"],
+ 'linker_so_cxx' : ["c++", "-shared"],
+ 'linker_exe_cxx' : ["c++"],
+ 'archiver' : ["ar", "-cr"],
+ 'ranlib' : None,
}
if sys.platform[:6] == "darwin":
@@ -110,12 +113,19 @@ class UnixCCompiler(CCompiler):
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
compiler_so = self.compiler_so
+ compiler_so_cxx = self.compiler_so_cxx
if sys.platform == 'darwin':
compiler_so = _osx_support.compiler_fixup(compiler_so,
cc_args + extra_postargs)
+ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx,
+ cc_args + extra_postargs)
try:
- self.spawn(compiler_so + cc_args + [src, '-o', obj] +
- extra_postargs)
+ if self.detect_language(src) == 'c++':
+ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
+ extra_postargs)
+ else:
+ self.spawn(compiler_so + cc_args + [src, '-o', obj] +
+ extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
@@ -173,30 +183,16 @@ class UnixCCompiler(CCompiler):
ld_args.extend(extra_postargs)
self.mkpath(os.path.dirname(output_filename))
try:
- if target_desc == CCompiler.EXECUTABLE:
- linker = self.linker_exe[:]
+ if target_lang == "c++":
+ if target_desc == CCompiler.EXECUTABLE:
+ linker = self.linker_exe_cxx[:]
+ else:
+ linker = self.linker_so_cxx[:]
else:
- linker = self.linker_so[:]
- if target_lang == "c++" and self.compiler_cxx:
- # skip over environment variable settings if /usr/bin/env
- # is used to set up the linker's environment.
- # This is needed on OSX. Note: this assumes that the
- # normal and C++ compiler have the same environment
- # settings.
- i = 0
- if os.path.basename(linker[0]) == "env":
- i = 1
- while '=' in linker[i]:
- i += 1
-
- if os.path.basename(linker[i]) == 'ld_so_aix':
- # AIX platforms prefix the compiler with the ld_so_aix
- # script, so we need to adjust our linker index
- offset = 1
+ if target_desc == CCompiler.EXECUTABLE:
+ linker = self.linker_exe[:]
else:
- offset = 0
-
- linker[i+offset] = self.compiler_cxx[i]
+ linker = self.linker_so[:]
if sys.platform == 'darwin':
linker = _osx_support.compiler_fixup(linker, ld_args)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 37cbb02890..3d724dfb51 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -606,10 +606,10 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
*\ -s*|s*) quiet="-q";; \
*) quiet="";; \
esac; \
- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
--
2.33.0
@@ -0,0 +1,186 @@
From 5260345d0d7acefb91590212d8d629abe9eb1538 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 5 Jan 2018 13:40:40 -0500
Subject: [PATCH 06/16] h2py: use binary I/O to avoid encoding issues
https://bugs.python.org/issue13032
---
Tools/scripts/h2py.py | 67 ++++++++++++++++++++++---------------------
1 file changed, 34 insertions(+), 33 deletions(-)
diff --git a/Tools/scripts/h2py.py b/Tools/scripts/h2py.py
index ea37c04d4c..aabea34697 100755
--- a/Tools/scripts/h2py.py
+++ b/Tools/scripts/h2py.py
@@ -23,36 +23,36 @@
import sys, re, getopt, os
-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(
- 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(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('//.*')
+p_comment = re.compile(br'/\*([^*]+|\*+[^/])*(\*+/)?')
+p_cpp_comment = re.compile(b'//.*')
ignores = [p_comment, p_cpp_comment]
-p_char = re.compile(r"'(\\.[^\\]*|[^\\])'")
+p_char = re.compile(br"'(\\.[^\\]*|[^\\])'")
-p_hex = re.compile(r"0x([0-9a-fA-F]+)L?")
+p_hex = re.compile(br"0x([0-9a-fA-F]+)L?")
filedict = {}
importable = {}
try:
- searchdirs=os.environ['include'].split(';')
+ searchdirs=os.environb[b'include'].split(b';')
except KeyError:
try:
- searchdirs=os.environ['INCLUDE'].split(';')
+ searchdirs=os.environb[b'INCLUDE'].split(b';')
except KeyError:
- searchdirs=['/usr/include']
+ searchdirs=[b'/usr/include']
try:
- searchdirs.insert(0, os.path.join('/usr/include',
- os.environ['MULTIARCH']))
+ searchdirs.insert(0, os.path.join(b'/usr/include',
+ os.environb[b'MULTIARCH']))
except KeyError:
pass
@@ -61,22 +61,23 @@ def main():
opts, args = getopt.getopt(sys.argv[1:], 'i:')
for o, a in opts:
if o == '-i':
- ignores.append(re.compile(a))
+ ignores.append(re.compile(a.encode()))
if not args:
args = ['-']
for filename in args:
if filename == '-':
sys.stdout.write('# Generated by h2py from stdin\n')
- process(sys.stdin, sys.stdout)
+ process(sys.stdin.buffer, sys.stdout.buffer)
else:
- with open(filename) as fp:
+ filename = filename.encode()
+ with open(filename, 'rb') as fp:
outfile = os.path.basename(filename)
- i = outfile.rfind('.')
+ i = outfile.rfind(b'.')
if i > 0: outfile = outfile[:i]
modname = outfile.upper()
- outfile = modname + '.py'
- with open(outfile, 'w') as outfp:
- outfp.write('# Generated by h2py from %s\n' % filename)
+ outfile = modname + b'.py'
+ with open(outfile, 'wb') as outfp:
+ outfp.write(b'# Generated by h2py from %s\n' % filename)
filedict = {}
for dir in searchdirs:
if filename[:len(dir)] == dir:
@@ -88,9 +89,9 @@ def main():
def pytify(body):
# replace ignored patterns by spaces
for p in ignores:
- body = p.sub(' ', body)
+ body = p.sub(b' ', body)
# replace char literals by ord(...)
- body = p_char.sub("ord('\\1')", body)
+ body = p_char.sub(b"ord('\\1')", body)
# Compute negative hexadecimal constants
start = 0
UMAX = 2*(sys.maxsize+1)
@@ -101,7 +102,7 @@ def pytify(body):
val = int(body[slice(*m.span(1))], 16)
if val > sys.maxsize:
val -= UMAX
- body = body[:s] + "(" + str(val) + ")" + body[e:]
+ body = body[:s] + b"(" + str(val).encode() + b")" + body[e:]
start = s + 1
return body
@@ -114,7 +115,7 @@ def process(fp, outfp, env = {}):
match = p_define.match(line)
if match:
# gobble up continuation lines
- while line[-2:] == '\\\n':
+ while line[-2:] == b'\\\n':
nextline = fp.readline()
if not nextline: break
lineno = lineno + 1
@@ -123,11 +124,11 @@ def process(fp, outfp, env = {}):
body = line[match.end():]
body = pytify(body)
ok = 0
- stmt = '%s = %s\n' % (name, body.strip())
+ stmt = name + b' = ' + body.strip() + b'\n'
try:
exec(stmt, env)
except:
- sys.stderr.write('Skipping: %s' % stmt)
+ sys.stderr.buffer.write(b'Skipping: ' + stmt)
else:
outfp.write(stmt)
match = p_macro.match(line)
@@ -135,11 +136,11 @@ def process(fp, outfp, env = {}):
macro, arg = match.group(1, 2)
body = line[match.end():]
body = pytify(body)
- stmt = 'def %s(%s): return %s\n' % (macro, arg, body)
+ stmt = b'def ' + macro + b'(' + arg + b'): return ' + body + b'\n'
try:
exec(stmt, env)
except:
- sys.stderr.write('Skipping: %s' % stmt)
+ sys.stderr.buffer.write(b'Skipping: ' + stmt)
else:
outfp.write(stmt)
match = p_include.match(line)
@@ -148,24 +149,24 @@ def process(fp, outfp, env = {}):
a, b = regs[1]
filename = line[a:b]
if filename in importable:
- outfp.write('from %s import *\n' % importable[filename])
+ outfp.write(b'from ' + importable[filename] + b' import *\n')
elif filename not in filedict:
filedict[filename] = None
inclfp = None
for dir in searchdirs:
try:
- inclfp = open(dir + '/' + filename)
+ inclfp = open(dir + b'/' + filename, 'rb')
break
except IOError:
pass
if inclfp:
with inclfp:
outfp.write(
- '\n# Included from %s\n' % filename)
+ b'\n# Included from %s\n' % filename)
process(inclfp, outfp, env)
else:
- sys.stderr.write('Warning - could not find file %s\n' %
- filename)
+ sys.stderr.buffer.write(b'Warning - could not find file ' +
+ filename + b'\n')
if __name__ == '__main__':
main()
--
2.33.0
@@ -0,0 +1,81 @@
From 1623362fd068507f5455cfb8cd8873fb268e9843 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sun, 5 Jun 2016 08:18:01 +0200
Subject: [PATCH 08/16] distutils: make -OO enable both opt-1 and opt-2
optimization
Bug: http://bugs.python.org/issue27226
Bug: https://bugs.gentoo.org/585060
---
Lib/distutils/command/build_py.py | 8 ++++----
Lib/distutils/command/install_lib.py | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/Lib/distutils/command/build_py.py b/Lib/distutils/command/build_py.py
index edc2171cd1..e34749d6eb 100644
--- a/Lib/distutils/command/build_py.py
+++ b/Lib/distutils/command/build_py.py
@@ -315,9 +315,9 @@ class build_py (Command):
if self.compile:
outputs.append(importlib.util.cache_from_source(
filename, optimization=''))
- if self.optimize > 0:
+ for opt in range(1, self.optimize + 1):
outputs.append(importlib.util.cache_from_source(
- filename, optimization=self.optimize))
+ filename, optimization=opt))
outputs += [
os.path.join(build_dir, filename)
@@ -387,8 +387,8 @@ class build_py (Command):
if self.compile:
byte_compile(files, optimize=0,
force=self.force, prefix=prefix, dry_run=self.dry_run)
- if self.optimize > 0:
- byte_compile(files, optimize=self.optimize,
+ for opt in range(1, self.optimize + 1):
+ byte_compile(files, optimize=opt,
force=self.force, prefix=prefix, dry_run=self.dry_run)
class build_py_2to3(build_py, Mixin2to3):
diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py
index 6154cf0943..049b662566 100644
--- a/Lib/distutils/command/install_lib.py
+++ b/Lib/distutils/command/install_lib.py
@@ -24,8 +24,8 @@ class install_lib(Command):
# 2) compile .pyc only (--compile --no-optimize; default)
# 3) compile .pyc and "opt-1" .pyc (--compile --optimize)
# 4) compile "opt-1" .pyc only (--no-compile --optimize)
- # 5) compile .pyc and "opt-2" .pyc (--compile --optimize-more)
- # 6) compile "opt-2" .pyc only (--no-compile --optimize-more)
+ # 5) compile .pyc, "opt-1" and "opt-2" .pyc (--compile --optimize-more)
+ # 6) compile "opt-1" and "opt-2" .pyc (--no-compile --optimize-more)
#
# The UI for this is two options, 'compile' and 'optimize'.
# 'compile' is strictly boolean, and only decides whether to
@@ -132,8 +132,8 @@ class install_lib(Command):
byte_compile(files, optimize=0,
force=self.force, prefix=install_root,
dry_run=self.dry_run)
- if self.optimize > 0:
- byte_compile(files, optimize=self.optimize,
+ for opt in range(1, self.optimize + 1):
+ byte_compile(files, optimize=opt,
force=self.force, prefix=install_root,
verbose=self.verbose, dry_run=self.dry_run)
@@ -167,9 +167,9 @@ class install_lib(Command):
if self.compile:
bytecode_files.append(importlib.util.cache_from_source(
py_file, optimization=''))
- if self.optimize > 0:
+ for opt in range(1, self.optimize + 1):
bytecode_files.append(importlib.util.cache_from_source(
- py_file, optimization=self.optimize))
+ py_file, optimization=opt))
return bytecode_files
--
2.33.0
+13 -2
View File
@@ -12,7 +12,7 @@
<License>custom</License>
<Summary>Next generation of the python high-level scripting language</Summary>
<Description>Python is an accessible, high-level, dynamically typed, interpreted programming language, designed with an emphasis on code readability. It includes an extensive standard library, and has a vast ecosystem of third-party libraries.</Description>
<Archive sha1sum="1561060627fd171de19c53eb374cd92d2f297bff" type="tarxz">https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tar.xz</Archive>
<Archive sha1sum="7643eccc15f5606bd0dc04affc7ea901e417165d" type="tarxz">https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tar.xz</Archive>
<!-- <Archive sha1sum="bf7badf7e248e0ecf465d33c2f5aeec774209227" type="targz" target="Python-3.8.5">https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz</Archive> -->
<BuildDependencies>
<Dependency>bzip2</Dependency>
@@ -31,7 +31,11 @@
<!--<Dependency>tcltk-devel</Dependency>-->
</BuildDependencies>
<Patches>
<Patch level="1">gentoo/0014-bpo-36384-Leading-zeros-in-IPv4-addresses-are-no-lon.patch</Patch>
<Patch level="1">gentoo/0001-Install-libpythonX.Y.a-in-usr-lib-instead-of-usr-lib.patch</Patch>
<Patch level="1">gentoo/0004-setup.py-exit-with-non-zero-status-on-failure.patch</Patch>
<Patch level="1">gentoo/0005-Improve-distutils-C-support.patch</Patch>
<Patch level="1">gentoo/0006-h2py-use-binary-I-O-to-avoid-encoding-issues.patch</Patch>
<Patch level="1">gentoo/0008-distutils-make-OO-enable-both-opt-1-and-opt-2-optimi.patch</Patch>
<Patch level="1">gentoo/0016-bpo-43650-Fix-MemoryError-on-zip.read-in-shutil._unp.patch</Patch>
<Patch level="1">gentoo/0017-bpo-43998-Default-to-TLS-1.2-and-increase-cipher-sui.patch</Patch>
</Patches>
@@ -127,6 +131,13 @@
</Package>
<History>
<Update release="17">
<Date>2021-10-18</Date>
<Version>3.8.12</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="16">
<Date>2021-08-27</Date>
<Version>3.8.11</Version>