rosa2021 new python3.11

This commit is contained in:
slava86 2023-04-20 00:20:40 +03:00
parent c7cd8cf97d
commit 5fe13dbd49
22 changed files with 968 additions and 696 deletions

View file

@ -1,3 +1,4 @@
sources:
Python-3.8.2.tar.xz: 5ae54baf26628a7ed74206650a31192e6d5c6f93
Python-3.11.3.tar.xz: baea3ce79cf35e53b4155a5f700516abcd14f49d
python-3.11.3-docs-html.tar.bz2: 3f00d0e7ed6590d2feb65d0f64a344ace3f973a1
python-3.8.2-docs-html.tar.bz2: b19ca23d6145568045a899b812af4d641b62af18

View file

@ -0,0 +1,308 @@
diff -up Python-3.11.0a7/Lib/distutils/cygwinccompiler.py.7~ Python-3.11.0a7/Lib/distutils/cygwinccompiler.py
--- Python-3.11.0a7/Lib/distutils/cygwinccompiler.py.7~ 2022-04-05 21:54:03.000000000 +0200
+++ Python-3.11.0a7/Lib/distutils/cygwinccompiler.py 2022-04-07 19:10:46.447865891 +0200
@@ -123,8 +123,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
@@ -138,9 +140,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":
@@ -164,8 +170,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)
@@ -300,9 +310,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 -up Python-3.11.0a7/Lib/distutils/sysconfig.py.7~ Python-3.11.0a7/Lib/distutils/sysconfig.py
--- Python-3.11.0a7/Lib/distutils/sysconfig.py.7~ 2022-04-05 21:54:03.000000000 +0200
+++ Python-3.11.0a7/Lib/distutils/sysconfig.py 2022-04-07 19:10:46.447865891 +0200
@@ -216,9 +216,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']
@@ -233,19 +236,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:
@@ -254,13 +265,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 -up Python-3.11.0a7/Lib/distutils/tests/test_sysconfig.py.7~ Python-3.11.0a7/Lib/distutils/tests/test_sysconfig.py
--- Python-3.11.0a7/Lib/distutils/tests/test_sysconfig.py.7~ 2022-04-05 21:54:03.000000000 +0200
+++ Python-3.11.0a7/Lib/distutils/tests/test_sysconfig.py 2022-04-07 19:10:46.447865891 +0200
@@ -117,12 +117,13 @@ class SysconfigTestCase(support.EnvironG
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'],
@@ -130,12 +131,12 @@ class SysconfigTestCase(support.EnvironG
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'],
@@ -152,6 +153,7 @@ class SysconfigTestCase(support.EnvironG
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'],
@@ -159,11 +161,11 @@ class SysconfigTestCase(support.EnvironG
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 -up Python-3.11.0a7/Lib/distutils/unixccompiler.py.7~ Python-3.11.0a7/Lib/distutils/unixccompiler.py
--- Python-3.11.0a7/Lib/distutils/unixccompiler.py.7~ 2022-04-07 19:10:46.440865864 +0200
+++ Python-3.11.0a7/Lib/distutils/unixccompiler.py 2022-04-07 19:10:46.447865891 +0200
@@ -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":
@@ -119,12 +122,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)
@@ -182,30 +192,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 -up Python-3.11.0a7/Lib/_osx_support.py.7~ Python-3.11.0a7/Lib/_osx_support.py
--- Python-3.11.0a7/Lib/_osx_support.py.7~ 2022-04-05 21:54:03.000000000 +0200
+++ Python-3.11.0a7/Lib/_osx_support.py 2022-04-07 19:10:46.447865891 +0200
@@ -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 -up Python-3.11.0a7/Makefile.pre.in.7~ Python-3.11.0a7/Makefile.pre.in
--- Python-3.11.0a7/Makefile.pre.in.7~ 2022-04-07 19:10:46.447865891 +0200
+++ Python-3.11.0a7/Makefile.pre.in 2022-04-07 19:11:37.234063127 +0200
@@ -732,9 +732,9 @@ sharedmods: $(BUILDPYTHON) pybuilddir.tx
*\ -s*|s*) quiet="-q";; \
*) quiet="";; \
esac; \
- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
+ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build

View file

@ -1,261 +0,0 @@
From 81904771db8b112c8617a111e989b68e55af7a9c Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 13 Jan 2010 21:25:18 +0000
Subject: [PATCH] 00102: Change the various install paths to use /usr/lib64/
instead or /usr/lib/
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Only used when "%{_lib}" == "lib64".
Co-authored-by: David Malcolm <dmalcolm@redhat.com>
Co-authored-by: Thomas Spura <tomspur@fedoraproject.org>
Co-authored-by: Slavek Kabrda <bkabrda@redhat.com>
Co-authored-by: Matej Stuchlik <mstuchli@redhat.com>
Co-authored-by: Tomas Orsava <torsava@redhat.com>
Co-authored-by: Charalampos Stratakis <cstratak@redhat.com>
Co-authored-by: Petr Viktorin <pviktori@redhat.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Iryna Shcherbina <shcherbina.iryna@gmail.com>
---
Lib/distutils/command/install.py | 4 ++--
Lib/distutils/sysconfig.py | 6 +++++-
Lib/distutils/tests/test_install.py | 3 ++-
Lib/site.py | 4 ++++
Lib/sysconfig.py | 12 ++++++------
Lib/test/test_site.py | 4 ++--
Makefile.pre.in | 2 +-
Modules/getpath.c | 6 +++---
configure | 4 ++--
configure.ac | 4 ++--
setup.py | 6 +++---
11 files changed, 32 insertions(+), 23 deletions(-)
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index c625c95bf7..ae4f915669 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -30,14 +30,14 @@ WINDOWS_SCHEME = {
INSTALL_SCHEMES = {
'unix_prefix': {
'purelib': '$base/lib/python$py_version_short/site-packages',
- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
+ 'platlib': '$platbase/lib64/python$py_version_short/site-packages',
'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
},
'unix_home': {
'purelib': '$base/lib/python',
- 'platlib': '$base/lib/python',
+ 'platlib': '$base/lib64/python',
'headers': '$base/include/python/$dist_name',
'scripts': '$base/bin',
'data' : '$base',
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index b51629eb94..9a4892a737 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -146,8 +146,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix":
+ if plat_specific or standard_lib:
+ lib = "lib64"
+ else:
+ lib = "lib"
libpython = os.path.join(prefix,
- "lib", "python" + get_python_version())
+ lib, "python" + get_python_version())
if standard_lib:
return libpython
else:
diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py
index 287ab1989e..d4c05e0ab1 100644
--- a/Lib/distutils/tests/test_install.py
+++ b/Lib/distutils/tests/test_install.py
@@ -57,8 +57,9 @@ class InstallTestCase(support.TempdirManager,
self.assertEqual(got, expected)
libdir = os.path.join(destination, "lib", "python")
+ platlibdir = os.path.join(destination, "lib64", "python")
check_path(cmd.install_lib, libdir)
- check_path(cmd.install_platlib, libdir)
+ check_path(cmd.install_platlib, platlibdir)
check_path(cmd.install_purelib, libdir)
check_path(cmd.install_headers,
os.path.join(destination, "include", "python", "foopkg"))
diff --git a/Lib/site.py b/Lib/site.py
index a065ab0b5d..22d53fa562 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -335,11 +335,15 @@ def getsitepackages(prefixes=None):
seen.add(prefix)
if os.sep == '/':
+ sitepackages.append(os.path.join(prefix, "lib64",
+ "python" + sys.version[:3],
+ "site-packages"))
sitepackages.append(os.path.join(prefix, "lib",
"python%d.%d" % sys.version_info[:2],
"site-packages"))
else:
sitepackages.append(prefix)
+ sitepackages.append(os.path.join(prefix, "lib64", "site-packages"))
sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
return sitepackages
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index b9e2fafbc0..0ae6d35b69 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -20,10 +20,10 @@ __all__ = [
_INSTALL_SCHEMES = {
'posix_prefix': {
- 'stdlib': '{installed_base}/lib/python{py_version_short}',
- 'platstdlib': '{platbase}/lib/python{py_version_short}',
+ 'stdlib': '{installed_base}/lib64/python{py_version_short}',
+ 'platstdlib': '{platbase}/lib64/python{py_version_short}',
'purelib': '{base}/lib/python{py_version_short}/site-packages',
- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
+ 'platlib': '{platbase}/lib64/python{py_version_short}/site-packages',
'include':
'{installed_base}/include/python{py_version_short}{abiflags}',
'platinclude':
@@ -62,10 +62,10 @@ _INSTALL_SCHEMES = {
'data': '{userbase}',
},
'posix_user': {
- 'stdlib': '{userbase}/lib/python{py_version_short}',
- 'platstdlib': '{userbase}/lib/python{py_version_short}',
+ 'stdlib': '{userbase}/lib64/python{py_version_short}',
+ 'platstdlib': '{userbase}/lib64/python{py_version_short}',
'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
+ 'platlib': '{userbase}/lib64/python{py_version_short}/site-packages',
'include': '{userbase}/include/python{py_version_short}',
'scripts': '{userbase}/bin',
'data': '{userbase}',
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 41c4229919..543c88432a 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -266,8 +266,8 @@ class HelperFunctionsTests(unittest.TestCase):
dirs = site.getsitepackages()
if os.sep == '/':
# OS X, Linux, FreeBSD, etc
- self.assertEqual(len(dirs), 1)
- wanted = os.path.join('xoxo', 'lib',
+ self.assertEqual(len(dirs), 2)
+ wanted = os.path.join('xoxo', 'lib64',
'python%d.%d' % sys.version_info[:2],
'site-packages')
self.assertEqual(dirs[0], wanted)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 502317aa0c..4ad3df1122 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -143,7 +143,7 @@ LIBDIR= @libdir@
MANDIR= @mandir@
INCLUDEDIR= @includedir@
CONFINCLUDEDIR= $(exec_prefix)/include
-SCRIPTDIR= $(prefix)/lib
+SCRIPTDIR= $(prefix)/lib64
ABIFLAGS= @ABIFLAGS@
# Detailed destination directories
diff --git a/Modules/getpath.c b/Modules/getpath.c
index b727f66953..a0c5fb6139 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -730,7 +730,7 @@ calculate_exec_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig,
if (safe_wcscpy(exec_prefix, calculate->exec_prefix, exec_prefix_len) < 0) {
return PATHLEN_ERR();
}
- status = joinpath(exec_prefix, L"lib/lib-dynload", exec_prefix_len);
+ status = joinpath(exec_prefix, L"lib64/lib-dynload", exec_prefix_len);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
@@ -1067,7 +1067,7 @@ calculate_zip_path(PyCalculatePath *calculate, const wchar_t *prefix,
return PATHLEN_ERR();
}
}
- status = joinpath(zip_path, L"lib/python00.zip", zip_path_len);
+ status = joinpath(zip_path, L"lib64/python00.zip", zip_path_len);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
@@ -1197,7 +1197,7 @@ calculate_init(PyCalculatePath *calculate, const PyConfig *config)
if (!calculate->exec_prefix) {
return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
}
- calculate->lib_python = Py_DecodeLocale("lib/python" VERSION, &len);
+ calculate->lib_python = Py_DecodeLocale("lib64/python" VERSION, &len);
if (!calculate->lib_python) {
return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
}
diff --git a/configure b/configure
index 2a933cdbeb..bec365124e 100755
--- a/configure
+++ b/configure
@@ -15182,9 +15182,9 @@ fi
if test x$PLATFORM_TRIPLET = x; then
- LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
+ LIBPL='$(prefix)'"/lib64/python${VERSION}/config-${LDVERSION}"
else
- LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+ LIBPL='$(prefix)'"/lib64/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
fi
diff --git a/configure.ac b/configure.ac
index a189d42c2c..154a0aa5cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4668,9 +4668,9 @@ fi
dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
AC_SUBST(PY_ENABLE_SHARED)
if test x$PLATFORM_TRIPLET = x; then
- LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
+ LIBPL='$(prefix)'"/lib64/python${VERSION}/config-${LDVERSION}"
else
- LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+ LIBPL='$(prefix)'"/lib64/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
fi
AC_SUBST(LIBPL)
diff --git a/setup.py b/setup.py
index 20d7f35652..024a1035c0 100644
--- a/setup.py
+++ b/setup.py
@@ -649,7 +649,7 @@ class PyBuildExt(build_ext):
# directories (i.e. '.' and 'Include') must be first. See issue
# 10520.
if not CROSS_COMPILING:
- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib64')
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:
@@ -953,11 +953,11 @@ class PyBuildExt(build_ext):
elif curses_library:
readline_libs.append(curses_library)
elif self.compiler.find_library_file(self.lib_dirs +
- ['/usr/lib/termcap'],
+ ['/usr/lib64/termcap'],
'termcap'):
readline_libs.append('termcap')
self.add(Extension('readline', ['readline.c'],
- library_dirs=['/usr/lib/termcap'],
+ library_dirs=['/usr/lib64/termcap'],
extra_link_args=readline_extra_link_args,
libraries=readline_libs))
else:
--
2.21.0

View file

@ -1,78 +0,0 @@
From 5b9fcc86532051bea5d0e9fa856b014f229f4794 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Mon, 18 Jan 2010 17:59:07 +0000
Subject: [PATCH] 00111: Don't try to build a libpythonMAJOR.MINOR.a
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Downstream only: not appropriate for upstream.
See https://bugzilla.redhat.com/show_bug.cgi?id=556092
Co-authored-by: David Malcolm <dmalcolm@redhat.com>
Co-authored-by: Bohuslav Kabrda <bkabrda@redhat.com>
Co-authored-by: Matej Stuchlik <mstuchli@redhat.com>
Co-authored-by: Robert Kuska <rkuska@redhat.com>
Co-authored-by: Charalampos Stratakis <cstratak@redhat.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
---
Makefile.pre.in | 21 ++-------------------
1 file changed, 2 insertions(+), 19 deletions(-)
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 4ad3df1122..72d202d71b 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -562,7 +562,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blake2s_impl.c
$(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(srcdir)
# Build the interpreter
-$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
+$(BUILDPYTHON): Programs/python.o $(LDLIBRARY) $(PY3LIBRARY)
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
platform: $(BUILDPYTHON) pybuilddir.txt
@@ -610,12 +610,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
-
-# Build static library
-$(LIBRARY): $(LIBRARY_OBJS)
- -rm -f $@
- $(AR) $(ARFLAGS) $@ $(LIBRARY_OBJS)
-
libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS)
if test $(INSTSONAME) != $(LDLIBRARY); then \
$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM); \
@@ -693,7 +687,7 @@ Makefile Modules/config.c: Makefile.pre \
@echo "The Makefile was updated, you may need to re-run make."
-Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY)
+Programs/_testembed: Programs/_testembed.o $(LDLIBRARY) $(PY3LIBRARY)
$(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS)
############################################################################
@@ -1557,17 +1551,6 @@ libainstall: @DEF_MAKE_RULE@ python-config
else true; \
fi; \
done
- @if test -d $(LIBRARY); then :; else \
- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
- if test "$(SHLIB_SUFFIX)" = .dll; then \
- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \
- else \
- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \
- fi; \
- else \
- echo Skip install of $(LIBRARY) - use make frameworkinstall; \
- fi; \
- fi
$(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c
$(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o
$(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in
--
2.21.0

View file

@ -0,0 +1,11 @@
diff -up Python-3.9.0/Modules/_gdbmmodule.c.17~ Python-3.9.0/Modules/_gdbmmodule.c
--- Python-3.9.0/Modules/_gdbmmodule.c.17~ 2020-10-18 20:11:06.336018040 +0200
+++ Python-3.9.0/Modules/_gdbmmodule.c 2020-10-18 20:11:45.349441470 +0200
@@ -133,6 +133,7 @@ dbm_length(dbmobject *dp)
}
okey=key;
}
+ if(okey.dsize) free(okey.dptr);
dp->di_size = size;
#endif
}

View file

@ -1,12 +0,0 @@
diff -up Python-3.5.0/Makefile.pre.in.lib Python-3.5.0/Makefile.pre.in
--- Python-3.5.0/Makefile.pre.in.lib 2015-09-21 15:39:47.928286620 +0200
+++ Python-3.5.0/Makefile.pre.in 2015-09-21 15:42:58.004042762 +0200
@@ -1340,7 +1340,7 @@ inclinstall:
# Install the library and miscellaneous stuff needed for extending/embedding
# This goes into $(exec_prefix)
-LIBPL= @LIBPL@
+LIBPL= $(LIBDEST)/config-$(LDVERSION)-$(MULTIARCH)
# pkgconfig directory
LIBPC= $(LIBDIR)/pkgconfig

View file

@ -1,34 +1,7 @@
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index 0258d3d..4ebf50a 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -418,8 +418,19 @@ class install(Command):
raise DistutilsOptionError(
"must not supply exec-prefix without prefix")
- self.prefix = os.path.normpath(sys.prefix)
- self.exec_prefix = os.path.normpath(sys.exec_prefix)
+ # self.prefix is set to sys.prefix + /local/
+ # if neither RPM build nor virtual environment is
+ # detected to make pip and distutils install packages
+ # into the separate location.
+ if (not (hasattr(sys, 'real_prefix') or
+ sys.prefix != sys.base_prefix) and
+ 'RPM_BUILD_ROOT' not in os.environ):
+ addition = "/local"
+ else:
+ addition = ""
+
+ self.prefix = os.path.normpath(sys.prefix) + addition
+ self.exec_prefix = os.path.normpath(sys.exec_prefix) + addition
else:
if self.exec_prefix is None:
diff --git a/Lib/site.py b/Lib/site.py
index 0fc9200..c95202e 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -322,7 +322,14 @@ def getsitepackages(prefixes=None):
diff -up Python-3.11.0a7/Lib/site.py.2~ Python-3.11.0a7/Lib/site.py
--- Python-3.11.0a7/Lib/site.py.2~ 2022-04-05 21:54:03.000000000 +0200
+++ Python-3.11.0a7/Lib/site.py 2022-04-07 19:08:48.674408380 +0200
@@ -377,8 +377,15 @@ def getsitepackages(prefixes=None):
return sitepackages
def addsitepackages(known_paths, prefixes=None):
@ -39,8 +12,65 @@ index 0fc9200..c95202e 100644
+ to make packages installed into this location visible.
+
+ """
_trace("Processing global site-packages")
+ if ENABLE_USER_SITE and 'RPM_BUILD_ROOT' not in os.environ:
+ PREFIXES.insert(0, "/usr/local")
for sitedir in getsitepackages(prefixes):
if os.path.isdir(sitedir):
addsitedir(sitedir, known_paths)
diff -up Python-3.11.0a7/Lib/sysconfig.py.2~ Python-3.11.0a7/Lib/sysconfig.py
--- Python-3.11.0a7/Lib/sysconfig.py.2~ 2022-04-07 19:08:48.674408380 +0200
+++ Python-3.11.0a7/Lib/sysconfig.py 2022-04-07 19:10:00.549687607 +0200
@@ -103,6 +103,31 @@ if os.name == 'nt':
else:
_INSTALL_SCHEMES['venv'] = _INSTALL_SCHEMES['posix_venv']
+# backup the original posix_prefix as rpm_prefix
+# RPM packages use it and we need to be able to read it even when changed
+_INSTALL_SCHEMES['rpm_prefix'] = _INSTALL_SCHEMES['posix_prefix']
+# Virtualenv >= 20.10.0 favors the "venv" scheme over the defaults when creating virtual environments.
+# See: https://github.com/pypa/virtualenv/commit/8da79db86d8a5c74d03667a40e64ff832076445e
+# See: https://bugs.python.org/issue45413
+# "venv" should be the same as the unpatched posix_prefix for us,
+# so new virtual environments aren't created with paths like venv/local/bin/python.
+_INSTALL_SCHEMES['venv'] = _INSTALL_SCHEMES['posix_prefix']
+
+if (not (hasattr(sys, 'real_prefix') or
+ sys.prefix != sys.base_prefix) and
+ 'RPM_BUILD_ROOT' not in os.environ):
+ _INSTALL_SCHEMES['posix_prefix'] = {
+ 'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
+ 'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}',
+ 'purelib': '{base}/local/lib/python{py_version_short}/site-packages',
+ 'platlib': '{platbase}/local/{platlibdir}/python{py_version_short}/site-packages',
+ 'include':
+ '{installed_base}/include/python{py_version_short}{abiflags}',
+ 'platinclude':
+ '{installed_platbase}/include/python{py_version_short}{abiflags}',
+ 'scripts': '{base}/local/bin',
+ 'data': '{base}/local',
+ }
# NOTE: site.py has copy of this function.
# Sync it when modify this function.
diff -up Python-3.11.0a7/Lib/test/test_sysconfig.py.2~ Python-3.11.0a7/Lib/test/test_sysconfig.py
--- Python-3.11.0a7/Lib/test/test_sysconfig.py.2~ 2022-04-05 21:54:03.000000000 +0200
+++ Python-3.11.0a7/Lib/test/test_sysconfig.py 2022-04-07 19:10:32.618812176 +0200
@@ -333,7 +333,7 @@ class TestSysConfig(unittest.TestCase):
self.assertTrue(os.path.isfile(config_h), config_h)
def test_get_scheme_names(self):
- wanted = ['nt', 'posix_home', 'posix_prefix', 'posix_venv', 'nt_venv', 'venv']
+ wanted = ['nt', 'posix_home', 'posix_prefix', 'posix_venv', 'nt_venv', 'venv', 'rpm_prefix']
if HAS_USER_BASE:
wanted.extend(['nt_user', 'osx_framework_user', 'posix_user'])
self.assertEqual(get_scheme_names(), tuple(sorted(wanted)))
@@ -345,6 +345,8 @@ class TestSysConfig(unittest.TestCase):
cmd = "-c", "import sysconfig; print(sysconfig.get_platform())"
self.assertEqual(py.call_real(*cmd), py.call_link(*cmd))
+ @unittest.skipIf('RPM_BUILD_ROOT' not in os.environ,
+ "Test doesn't expect Fedora's paths")
def test_user_similar(self):
# Issue #8759: make sure the posix scheme for the users
# is similar to the global posix_prefix one

View file

@ -1,86 +0,0 @@
From 02443c3177bd15ddc48e7c3fc1dd2b6a3c095888 Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pviktori@redhat.com>
Date: Mon, 28 Aug 2017 17:16:46 +0200
Subject: [PATCH] 00274: Upstream uses Debian-style architecture naming, change
to match Fedora
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Petr Viktorin <pviktori@redhat.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Tomas Orsava <torsava@redhat.com>
---
config.sub | 2 +-
configure.ac | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/config.sub b/config.sub
index ba37cf99e2..52a9ec6662 100755
--- a/config.sub
+++ b/config.sub
@@ -1042,7 +1042,7 @@ case $basic_machine in
;;
ppc64) basic_machine=powerpc64-unknown
;;
- ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
+ ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown
diff --git a/configure.ac b/configure.ac
index 154a0aa5cc..273954f461 100644
--- a/configure.ac
+++ b/configure.ac
@@ -741,9 +741,9 @@ cat >> conftest.c <<EOF
alpha-linux-gnu
# elif defined(__ARM_EABI__) && defined(__ARM_PCS_VFP)
# if defined(__ARMEL__)
- arm-linux-gnueabihf
+ arm-linux-gnueabi
# else
- armeb-linux-gnueabihf
+ armeb-linux-gnueabi
# endif
# elif defined(__ARM_EABI__) && !defined(__ARM_PCS_VFP)
# if defined(__ARMEL__)
@@ -783,7 +783,7 @@ cat >> conftest.c <<EOF
# elif _MIPS_SIM == _ABIN32
mips64el-linux-gnuabin32
# elif _MIPS_SIM == _ABI64
- mips64el-linux-gnuabi64
+ mips64el-linux-gnu
# else
# error unknown platform triplet
# endif
@@ -793,22 +793,22 @@ cat >> conftest.c <<EOF
# elif _MIPS_SIM == _ABIN32
mips64-linux-gnuabin32
# elif _MIPS_SIM == _ABI64
- mips64-linux-gnuabi64
+ mips64-linux-gnu
# else
# error unknown platform triplet
# endif
# elif defined(__or1k__)
or1k-linux-gnu
# elif defined(__powerpc__) && defined(__SPE__)
- powerpc-linux-gnuspe
+ ppc-linux-gnuspe
# elif defined(__powerpc64__)
# if defined(__LITTLE_ENDIAN__)
- powerpc64le-linux-gnu
+ ppc64le-linux-gnu
# else
- powerpc64-linux-gnu
+ ppc64-linux-gnu
# endif
# elif defined(__powerpc__)
- powerpc-linux-gnu
+ ppc-linux-gnu
# elif defined(__s390x__)
s390x-linux-gnu
# elif defined(__s390__)
--
2.21.0

View file

@ -1,4 +1,4 @@
From 62c2cdc7a459328e8792f9a029c74f12c4a0abf0 Mon Sep 17 00:00:00 2001
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Thu, 11 Jul 2019 13:44:13 +0200
Subject: [PATCH] 00328: Restore pyc to TIMESTAMP invalidation mode as default
@ -11,13 +11,15 @@ performance decrease. To avoid that, we don't default to CHECKED_HASH
when $RPM_BUILD_ROOT is set (i.e. when we are building RPM packages).
See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426
Downstream only: only used when building RPM packages
Ideally, we should talk to upstream and explain why we don't want this
---
Lib/py_compile.py | 3 ++-
Lib/test/test_py_compile.py | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
index 21736896af..310bed5620 100644
index 388614e51b..db52725016 100644
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -70,7 +70,8 @@ class PycInvalidationMode(enum.Enum):
@ -31,25 +33,22 @@ index 21736896af..310bed5620 100644
else:
return PycInvalidationMode.TIMESTAMP
diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
index d6677ab45f..88059b127e 100644
index 794d6436b6..322e072b61 100644
--- a/Lib/test/test_py_compile.py
+++ b/Lib/test/test_py_compile.py
@@ -17,6 +17,7 @@ def without_source_date_epoch(fxn):
@@ -19,6 +19,7 @@ def without_source_date_epoch(fxn):
def wrapper(*args, **kwargs):
with support.EnvironmentVarGuard() as env:
with os_helper.EnvironmentVarGuard() as env:
env.unset('SOURCE_DATE_EPOCH')
+ env.unset('RPM_BUILD_ROOT')
return fxn(*args, **kwargs)
return wrapper
@@ -27,6 +28,7 @@ def with_source_date_epoch(fxn):
@@ -29,6 +30,7 @@ def with_source_date_epoch(fxn):
def wrapper(*args, **kwargs):
with support.EnvironmentVarGuard() as env:
with os_helper.EnvironmentVarGuard() as env:
env['SOURCE_DATE_EPOCH'] = '123456789'
+ env.unset('RPM_BUILD_ROOT')
return fxn(*args, **kwargs)
return wrapper
--
2.21.0

View file

@ -0,0 +1,103 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= <thrnciar@redhat.com>
Date: Tue, 7 Dec 2021 14:41:59 +0100
Subject: [PATCH] 00371: Revert "bpo-1596321: Fix threading._shutdown() for the
main thread (GH-28549) (GH-28589)"
This reverts commit 38c67738c64304928c68d5c2bd78bbb01d979b94. It
introduced regression causing FreeIPA's tests to fail.
For more info see:
https://bodhi.fedoraproject.org/updates/FEDORA-2021-e152ce5f31
https://github.com/GrahamDumpleton/mod_wsgi/issues/730
---
Lib/test/test_threading.py | 33 ---------------------------------
Lib/threading.py | 25 ++++++++-----------------
2 files changed, 8 insertions(+), 50 deletions(-)
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 9c6561c099..84714c03fe 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -956,39 +956,6 @@ def test_debug_deprecation(self):
b'is deprecated and will be removed in Python 3.12')
self.assertIn(msg, err)
- def test_import_from_another_thread(self):
- # bpo-1596321: If the threading module is first import from a thread
- # different than the main thread, threading._shutdown() must handle
- # this case without logging an error at Python exit.
- code = textwrap.dedent('''
- import _thread
- import sys
-
- event = _thread.allocate_lock()
- event.acquire()
-
- def import_threading():
- import threading
- event.release()
-
- if 'threading' in sys.modules:
- raise Exception('threading is already imported')
-
- _thread.start_new_thread(import_threading, ())
-
- # wait until the threading module is imported
- event.acquire()
- event.release()
-
- if 'threading' not in sys.modules:
- raise Exception('threading is not imported')
-
- # don't wait until the thread completes
- ''')
- rc, out, err = assert_python_ok("-c", code)
- self.assertEqual(out, b'')
- self.assertEqual(err, b'')
-
class ThreadJoinOnShutdown(BaseTestCase):
diff --git a/Lib/threading.py b/Lib/threading.py
index 4f72938551..18c10e6489 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -1546,29 +1546,20 @@ def _shutdown():
global _SHUTTING_DOWN
_SHUTTING_DOWN = True
+ # Main thread
+ tlock = _main_thread._tstate_lock
+ # The main thread isn't finished yet, so its thread state lock can't have
+ # been released.
+ assert tlock is not None
+ assert tlock.locked()
+ tlock.release()
+ _main_thread._stop()
# Call registered threading atexit functions before threads are joined.
# Order is reversed, similar to atexit.
for atexit_call in reversed(_threading_atexits):
atexit_call()
- # Main thread
- if _main_thread.ident == get_ident():
- tlock = _main_thread._tstate_lock
- # The main thread isn't finished yet, so its thread state lock can't
- # have been released.
- assert tlock is not None
- assert tlock.locked()
- tlock.release()
- _main_thread._stop()
- else:
- # bpo-1596321: _shutdown() must be called in the main thread.
- # If the threading module was not imported by the main thread,
- # _main_thread is the thread which imported the threading module.
- # In this case, ignore _main_thread, similar behavior than for threads
- # spawned by C libraries or using _thread.start_new_thread().
- pass
-
# Join all non-deamon threads
while True:
with _shutdown_locks_lock:

19
Python-3.8.0-c++.patch Normal file
View file

@ -0,0 +1,19 @@
diff -up Python-3.8.0/Include/dynamic_annotations.h.omv~ Python-3.8.0/Include/dynamic_annotations.h
--- Python-3.8.0/Include/dynamic_annotations.h.omv~ 2019-11-03 21:12:44.032504529 +0100
+++ Python-3.8.0/Include/dynamic_annotations.h 2019-11-03 21:13:44.009529546 +0100
@@ -460,6 +460,7 @@ int RunningOnValgrind(void);
#endif
#if DYNAMIC_ANNOTATIONS_ENABLED != 0 && defined(__cplusplus)
+extern "C++" { // We might be included from an extern "C" block...
/* _Py_ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads.
@@ -476,6 +477,7 @@ int RunningOnValgrind(void);
_Py_ANNOTATE_IGNORE_READS_END();
return res;
}
+}
/* Apply _Py_ANNOTATE_BENIGN_RACE_SIZED to a static variable. */
#define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \
namespace { \

13
fix-attribute-e2k.patch Normal file
View file

@ -0,0 +1,13 @@
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 230cde4..ccb8fa6 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -1152,7 +1152,7 @@
#if defined(FAULTHANDLER_USE_ALT_STACK)
#define FAULTHANDLER_STACK_OVERFLOW
-static uintptr_t
+__attribute__((optimize(0))) static uintptr_t
stack_overflow(uintptr_t min_sp, uintptr_t max_sp, size_t *depth)
{
/* Allocate (at least) 4096 bytes on the stack at each call.

171
import_all_modules.py Normal file
View file

@ -0,0 +1,171 @@
'''Script to perform import of each module given to %%py_check_import
'''
import argparse
import importlib
import fnmatch
import os
import re
import site
import sys
from contextlib import contextmanager
from pathlib import Path
def read_modules_files(file_paths):
'''Read module names from the files (modules must be newline separated).
Return the module names list or, if no files were provided, an empty list.
'''
if not file_paths:
return []
modules = []
for file in file_paths:
file_contents = file.read_text()
modules.extend(file_contents.split())
return modules
def read_modules_from_cli(argv):
'''Read module names from command-line arguments (space or comma separated).
Return the module names list.
'''
if not argv:
return []
# %%py3_check_import allows to separate module list with comma or whitespace,
# we need to unify the output to a list of particular elements
modules_as_str = ' '.join(argv)
modules = re.split(r'[\s,]+', modules_as_str)
# Because of shell expansion in some less typical cases it may happen
# that a trailing space will occur at the end of the list.
# Remove the empty items from the list before passing it further
modules = [m for m in modules if m]
return modules
def filter_top_level_modules_only(modules):
'''Filter out entries with nested modules (containing dot) ie. 'foo.bar'.
Return the list of top-level modules.
'''
return [module for module in modules if '.' not in module]
def any_match(text, globs):
'''Return True if any of given globs fnmatchcase's the given text.'''
return any(fnmatch.fnmatchcase(text, g) for g in globs)
def exclude_unwanted_module_globs(globs, modules):
'''Filter out entries which match the either of the globs given as argv.
Return the list of filtered modules.
'''
return [m for m in modules if not any_match(m, globs)]
def read_modules_from_all_args(args):
'''Return a joined list of modules from all given command-line arguments.
'''
modules = read_modules_files(args.filename)
modules.extend(read_modules_from_cli(args.modules))
if args.exclude:
modules = exclude_unwanted_module_globs(args.exclude, modules)
if args.top_level:
modules = filter_top_level_modules_only(modules)
# Error when someone accidentally managed to filter out everything
if len(modules) == 0:
raise ValueError('No modules to check were left')
return modules
def import_modules(modules):
'''Procedure to perform import check for each module name from the given list of modules.
'''
for module in modules:
print('Check import:', module, file=sys.stderr)
importlib.import_module(module)
def argparser():
parser = argparse.ArgumentParser(
description='Generate list of all importable modules for import check.'
)
parser.add_argument(
'modules', nargs='*',
help=('Add modules to check the import (space or comma separated).'),
)
parser.add_argument(
'-f', '--filename', action='append', type=Path,
help='Add importable module names list from file.',
)
parser.add_argument(
'-t', '--top-level', action='store_true',
help='Check only top-level modules.',
)
parser.add_argument(
'-e', '--exclude', action='append',
help='Provide modules globs to be excluded from the check.',
)
return parser
@contextmanager
def remove_unwanteds_from_sys_path():
'''Remove cwd and this script's parent from sys.path for the import test.
Bring the original contents back after import is done (or failed)
'''
cwd_absolute = Path.cwd().absolute()
this_file_parent = Path(__file__).parent.absolute()
old_sys_path = list(sys.path)
for path in old_sys_path:
if Path(path).absolute() in (cwd_absolute, this_file_parent):
sys.path.remove(path)
try:
yield
finally:
sys.path = old_sys_path
def addsitedirs_from_environ():
'''Load directories from the _PYTHONSITE environment variable (separated by :)
and load the ones already present in sys.path via site.addsitedir()
to handle .pth files in them.
This is needed to properly import old-style namespace packages with nspkg.pth files.
See https://bugzilla.redhat.com/2018551 for a more detailed rationale.'''
for path in os.getenv('_PYTHONSITE', '').split(':'):
if path in sys.path:
site.addsitedir(path)
def main(argv=None):
cli_args = argparser().parse_args(argv)
if not cli_args.modules and not cli_args.filename:
raise ValueError('No modules to check were provided')
modules = read_modules_from_all_args(cli_args)
with remove_unwanteds_from_sys_path():
addsitedirs_from_environ()
import_modules(modules)
if __name__ == '__main__':
main()

View file

@ -1,13 +0,0 @@
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index 2d7cdf0..058809b 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -724,7 +724,7 @@ class build_ext(Command):
# Windows like MinGW) it is simply necessary that all symbols in
# shared libraries are resolved at link time.
from distutils.sysconfig import get_config_var
- link_libpython = False
+ link_libpython = True
if get_config_var('Py_ENABLE_SHARED'):
# A native build on an Android device or on Cygwin
if hasattr(sys, 'getandroidapilevel'):

View file

@ -0,0 +1,81 @@
diff -up Python-3.11.0a5/Include/internal/pycore_atomic.h.6~ Python-3.11.0a5/Include/internal/pycore_atomic.h
--- Python-3.11.0a5/Include/internal/pycore_atomic.h.6~ 2022-02-03 19:37:08.000000000 +0100
+++ Python-3.11.0a5/Include/internal/pycore_atomic.h 2022-02-08 17:49:48.488052459 +0100
@@ -1,5 +1,18 @@
#ifndef Py_ATOMIC_H
#define Py_ATOMIC_H
+
+#if defined(__cplusplus) && !defined(NO_CXX_ATOMICS)
+#include <atomic>
+typedef std::atomic<uintptr_t> atomic_uintptr_t;
+typedef std::atomic<int> atomic_int;
+#define memory_order_relaxed std::memory_order_relaxed
+#define memory_order_acquire std::memory_order_acquire
+#define memory_order_release std::memory_order_release
+#define memory_order_acq_rel std::memory_order_acq_rel
+#define memory_order_seq_cst std::memory_order_seq_cst
+#define CXX_ATOMICS 1
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -11,7 +24,7 @@ extern "C" {
#include "dynamic_annotations.h" /* _Py_ANNOTATE_MEMORY_ORDER */
#include "pyconfig.h"
-#ifdef HAVE_STD_ATOMIC
+#if defined(HAVE_STD_ATOMIC) && !defined(CXX_ATOMICS)
# include <stdatomic.h>
#endif
diff -up Python-3.11.0a5/Include/internal/pycore_gil.h.6~ Python-3.11.0a5/Include/internal/pycore_gil.h
--- Python-3.11.0a5/Include/internal/pycore_gil.h.6~ 2022-02-03 19:37:08.000000000 +0100
+++ Python-3.11.0a5/Include/internal/pycore_gil.h 2022-02-08 17:49:06.774200895 +0100
@@ -1,5 +1,8 @@
#ifndef Py_INTERNAL_GIL_H
#define Py_INTERNAL_GIL_H
+
+#include "pycore_atomic.h" /* Intentionally not in extern C */
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -8,7 +11,6 @@ extern "C" {
# error "this header requires Py_BUILD_CORE define"
#endif
-#include "pycore_atomic.h" /* _Py_atomic_address */
#include "pycore_condvar.h" /* PyCOND_T */
#ifndef Py_HAVE_CONDVAR
diff -up Python-3.11.0a5/Include/internal/pycore_initconfig.h.6~ Python-3.11.0a5/Include/internal/pycore_initconfig.h
--- Python-3.11.0a5/Include/internal/pycore_initconfig.h.6~ 2022-02-03 19:37:08.000000000 +0100
+++ Python-3.11.0a5/Include/internal/pycore_initconfig.h 2022-02-08 17:49:06.774200895 +0100
@@ -1,5 +1,6 @@
#ifndef Py_INTERNAL_CORECONFIG_H
#define Py_INTERNAL_CORECONFIG_H
+
#ifdef __cplusplus
extern "C" {
#endif
diff -up Python-3.11.0a5/Include/internal/pycore_pylifecycle.h.6~ Python-3.11.0a5/Include/internal/pycore_pylifecycle.h
--- Python-3.11.0a5/Include/internal/pycore_pylifecycle.h.6~ 2022-02-03 19:37:08.000000000 +0100
+++ Python-3.11.0a5/Include/internal/pycore_pylifecycle.h 2022-02-08 17:49:06.774200895 +0100
@@ -1,5 +1,6 @@
#ifndef Py_INTERNAL_LIFECYCLE_H
#define Py_INTERNAL_LIFECYCLE_H
+
#ifdef __cplusplus
extern "C" {
#endif
diff -up Python-3.11.0a5/Include/internal/pycore_pystate.h.6~ Python-3.11.0a5/Include/internal/pycore_pystate.h
--- Python-3.11.0a5/Include/internal/pycore_pystate.h.6~ 2022-02-03 19:37:08.000000000 +0100
+++ Python-3.11.0a5/Include/internal/pycore_pystate.h 2022-02-08 17:49:06.774200895 +0100
@@ -1,5 +1,6 @@
#ifndef Py_INTERNAL_PYSTATE_H
#define Py_INTERNAL_PYSTATE_H
+
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -1,17 +0,0 @@
diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py
index ac9cff7..db98159 100644
--- a/Lib/test/test_pwd.py
+++ b/Lib/test/test_pwd.py
@ -95,9 +95,9 @@ class PwdTest(unittest.TestCase):
# In some cases, byuids isn't a complete list of all users in the
# system, so if we try to pick a value not in byuids (via a perturbing
# loop, say), pwd.getpwuid() might still be able to find data for that
- # uid. Using sys.maxint may provoke the same problems, but hopefully
+ # uid. Using 2**32 - 2 may provoke the same problems, but hopefully
# it will be a more repeatable failure.
- fakeuid = sys.maxsize
+ fakeuid = 2**32 - 2
self.assertNotIn(fakeuid, byuids)
self.assertRaises(KeyError, pwd.getpwuid, fakeuid)

View file

@ -5,9 +5,9 @@ set -efu
find "$RPM_BUILD_ROOT" -type f -print | while read -r line ; do
if file "$line" | grep -q ELF ; then continue ; fi
if head -n 1 "$line" | grep -qE '([[:blank:]])*#([[:blank:]])*\!([[:blank:]])*.*python3' ; then
sed -i -e '1s,python3,python3.8,g' -e '1s,python3.8.8,python3.8,g' "$line"
sed -i -e '1s,python3,python3.11,g' -e '1s,python3.8.8,python3.8,g' "$line"
sed -E -i "$line" \
-e '1s,([[:blank:]])*#([[:blank:]])*\!([[:blank:]])*/usr/bin/env([[:blank:]])*python3.8,#!/usr/libexec/python3.8,g' \
-e '1s,([[:blank:]])*#([[:blank:]])*\!([[:blank:]])*/usr/bin/python3.8,#!/usr/libexec/python3.8,g'
-e '1s,([[:blank:]])*#([[:blank:]])*\!([[:blank:]])*/usr/bin/env([[:blank:]])*python3.11,#!/usr/libexec/python3.11,g' \
-e '1s,([[:blank:]])*#([[:blank:]])*\!([[:blank:]])*/usr/bin/python3.8,#!/usr/libexec/python3.11,g'
fi
done

107
python3.11.macros Normal file
View file

@ -0,0 +1,107 @@
%__python3.11 /usr/libexec/python3.11
%python3_pkgversion 3
%python3_platform %(RPM_BUILD_ROOT= %{__python3} -Ic "import sysconfig; print(sysconfig.get_platform())")
%python3_platform %(RPM_BUILD_ROOT= %{__python3} -Ic "import sysconfig; print(sysconfig.get_platform())")
%python3_sitearch %(RPM_BUILD_ROOT= %{__python3} -Ic "import sysconfig; print(sysconfig.get_path('platlib', vars={'platbase': '%{_prefix}'}))")
%python3_sitelib %(RPM_BUILD_ROOT= %{__python3} -Ic "import sysconfig; print(sysconfig.get_path('purelib', vars={'base': '%{_prefix}'}))")
%python3_version %(RPM_BUILD_ROOT= %{__python3} -Ic "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
%python3_version_nodots %(RPM_BUILD_ROOT= %{__python3} -Ic "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
%py3_ver %(%{__python3} -c "import sys; v=sys.version_info[:2]; print('%%d.%%d'%%v)" 2>/dev/null || echo PYTHON-NOT-FOUND)
%py3_prefix %(%{__python3} -c "import sys; print(sys.prefix)" 2>/dev/null || echo PYTHON-NOT-FOUND)
%py3_platsitedir %python3_sitearch
%py3_puresitedir %python3_sitelib
%py3_incdir %(RPM_BUILD_ROOT= %{__python3} -c "import sysconfig; print(sysconfig.get_path('include', vars={'installed_base': '%{_prefix}'}))" 2>/dev/null || echo PYTHON-INCLUDEDIR-NOT-FOUND)
%py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
# %%py_setup setup.py # in rpm-openmandriva-setup
%py3_shbang_opts -s
%py3_build() %{expand:\
CFLAGS="%{optflags} -lpython%{py3_ver}" %{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?*}\
}
%py3_install() %{expand:\
CFLAGS="%{optflags} -lpython%{py3_ver}" %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}\
}
%py3_test() %{expand:\
%{__python3} %{py_setup} %{?py_setup_args} test %{?1}\
}
%py3_compile(O) \
find %1 -name '*.pyc' -exec rm -f {} \\; \
%{__python3} -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
%{-O: \
find %1 -name '*.pyo' -exec rm -f {} \\; \
%{__python3} -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
}
# This is intended for Python 3 only, hence also no Python version in the name.
%__pytest /usr/bin/pytest-3
%pytest %{expand:\\\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"}\\\
%__pytest}
%py3_shbang_opts -s
%py3_shbang_opts_nodash %(opts=%{py3_shbang_opts}; echo ${opts#-})
%py3_shebang_flags %(opts=%{py3_shbang_opts}; echo ${opts#-})
%py3_shebang_fix %{expand:\\\
if [ -f /usr/bin/pathfix%{python3_version}.py ]; then
pathfix=/usr/bin/pathfix%{python3_version}.py
else
# older versions of Python don't have it and must BR /usr/bin/pathfix.py from python3-devel explicitly
pathfix=/usr/bin/pathfix.py
fi
if [ -z "%{?py3_shebang_flags}" ]; then
shebang_flags="-k"
else
shebang_flags="-ka%{py3_shebang_flags}"
fi
$pathfix -pni %{__python3} $shebang_flags}
%py3_install_egg() %{expand:\\\
mkdir -p %{buildroot}%{python3_sitelib}
%{__python3} -m easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python3_version}.egg %{?*}
rm -rfv %{buildroot}%{_bindir}/__pycache__
}
%py3_install_wheel() %{expand:\\\
%{__python3} -m pip install -I dist/%{1} --root %{buildroot} --no-deps --no-index --no-warn-script-location
rm -rfv %{buildroot}%{_bindir}/__pycache__
for distinfo in %{buildroot}%{python3_sitelib}/*.dist-info %{buildroot}%{python3_sitearch}/*.dist-info; do
if [ -f ${distinfo}/direct_url.json ]; then
rm -fv ${distinfo}/direct_url.json
sed -i '/direct_url.json/d' ${distinfo}/RECORD
fi
done
}
# With $PATH and $PYTHONPATH set to the %%buildroot,
# try to import the Python 3 module(s) given as command-line args or read from file (-f).
# Respect the custom values of %%py3_shebang_flags or set nothing if it's undefined.
# Filter and check import on only top-level modules using -t flag.
# Exclude unwanted modules by passing their globs to -e option.
# Useful as a smoke test in %%check when running tests is not feasible.
# Use spaces or commas as separators if providing list directly.
# Use newlines as separators if providing list in a file.
%py3_check_import(e:tf:) %{expand:\\\
PATH="%{buildroot}%{_bindir}:$PATH"\\\
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}"\\\
_PYTHONSITE="%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}"\\\
PYTHONDONTWRITEBYTECODE=1\\\
%{lua:
local command = "%{__python3} "
if rpm.expand("%{?py3_shebang_flags}") ~= "" then
command = command .. "-%{py3_shebang_flags}"
end
command = command .. " %{_rpmconfigdir}/redhat/import_all_modules.py "
-- handle multiline arguments correctly, see https://bugzilla.redhat.com/2018809
local args=rpm.expand('%{?**}'):gsub("[%s\\\\]*%s+", " ")
print(command .. args)
}
}

View file

@ -1,13 +1,15 @@
%define docver 3.8.2
%define dirver 3.8
%define _duplicate_files_terminate_build 0
%define docver 3.11.3
%define dirver 3.11
%define familyver 3
%define lib_major %{dirver}
%define lib_name_orig libpython%{sub_ver}
%define lib_name_orig libpython%{familyver}.11
%define lib_name %mklibname python %{lib_major}
%define develname %mklibname python%{sub_ver} -d
%define develname %mklibname python3.11 -d
%ifarch %{ix86} x86_64 ppc
%ifarch %{ix86} %{x86_64} ppc
%bcond_with valgrind
%else
%bcond_with valgrind
@ -15,27 +17,6 @@
%bcond_without rewheel
####### python38 rosa201905 ###############
%bcond_without py38
%if %{with py38}
%define py3_name python38
%else
%define py3_name python3
%endif
%if %{with py38}
%define sub_ver 38
%else
%define sub_ver %{familyver}
%endif
# one dir for rpm4/5
%global _libexecdir /usr/libexec
###########################################
# We want to byte-compile the .py files within the packages using the new
# python3 binary.
#
@ -52,41 +33,28 @@
%define _python_bytecompile_build 0
Summary: An interpreted, interactive object-oriented programming language
Name: %{py3_name}
Version: 3.8.2
Release: 8
Name: python3.11
Version: 3.11.3
Release: 1
License: Modified CNRI Open Source License
Group: Development/Python
Source0: https://www.python.org/ftp/python/%{version}/Python-%{version}.tar.xz
Source1: https://docs.python.org/3/archives/python-%{docver}-docs-html.tar.bz2
Source2: python38.macros
Source3: pybytecompile.macros
Source4: python38-shebang-sanity.sh
Source100: python38.rpmlintrc
Source2: python3.11.macros
Source3: py3.11bytecompile.macros
Source4: import_all_modules.py
Source5: python3.11-shebang-sanity.sh
Source100: %{name}.rpmlintrc
# 00001 #
# Fixup distutils/unixccompiler.py to remove standard library path from rpath:
# Was Patch0 in ivazquez' python3000 specfile:
Patch1: 00001-rpath.patch
# 00102 #
# Change the various install paths to use /usr/lib64/ instead or /usr/lib
# Only used when "%%{_lib}" == "lib64"
# Not yet sent upstream.
Patch102: 00102-lib64.patch
# 00111 #
# Patch the Makefile.pre.in so that the generated Makefile doesn't try to build
# a libpythonMAJOR.MINOR.a
# See https://bugzilla.redhat.com/show_bug.cgi?id=556092
# Downstream only: not appropriate for upstream
Patch111: 00111-no-static-lib.patch
# 00205 #
# LIBPL variable in makefile takes LIBPL from configure.ac
# but the LIBPL variable defined there doesn't respect libdir macro
Patch205: 00205-make-libpl-respect-lib64.patch
Patch2: Python-3.8.0-c++.patch
Patch3: python-3.8.0-c++atomics.patch
Patch4: 0005-Improve-distutils-C-support.patch
Patch5: 00201-fix-memory-leak-in-gdbm.patch
# 00251
# Set values of prefix and exec_prefix in distutils install command
@ -95,27 +63,29 @@ Patch205: 00205-make-libpl-respect-lib64.patch
# Fedora Change: https://fedoraproject.org/wiki/Changes/Making_sudo_pip_safe
Patch251: 00251-change-user-install-location.patch
# 00274 #
# Upstream uses Debian-style architecture naming. Change to match Fedora.
Patch274: 00274-fix-arch-names.patch
# 00328 #
# Restore pyc to TIMESTAMP invalidation mode as default in rpmbubild
# See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426
Patch328: 00328-pyc-timestamp-invalidation-mode.patch
# For more info see:
# https://bodhi.fedoraproject.org/updates/FEDORA-2021-e152ce5f31
# https://github.com/GrahamDumpleton/mod_wsgi/issues/730
Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch
#
# Mageia patches
#
Patch501: python3-3.5.2-skip-distutils-tests-that-fail-in-rpmbuild.patch
Patch502: python3-3.7.1-uid-gid-overflows.patch
Patch503: python3-3.5.2-dont-raise-from-py_compile.patch
Patch506: python3-3.6.2-python3-config-LIBPLUSED-cmp0004-error.patch
Patch507: link-C-modules-with-libpython.patch
Patch508: fix-attribute-e2k.patch
URL: http://www.python.org/
Requires: %{lib_name} = %{EVRD}
BuildRequires: automake
BuildRequires: autoconf-archive
BuildRequires: gcc-c++
BuildRequires: blt
BuildRequires: db-devel
@ -124,6 +94,9 @@ BuildRequires: gdbm-devel
BuildRequires: gmp-devel
BuildRequires: ffi-devel
BuildRequires: pkgconfig(ncursesw)
BuildRequires: pkgconfig(libnsl)
# build ssl module fail with error SSLV3_method not found
#BuildRequires: pkgconfig(openssl)
BuildRequires: openssl-devel
BuildRequires: readline-devel
BuildRequires: tcl tcl-devel
@ -131,6 +104,8 @@ BuildRequires: tk tk-devel
BuildRequires: autoconf
BuildRequires: bzip2-devel
BuildRequires: sqlite3-devel
BuildRequires: xz-devel
BuildRequires: uuid-devel
%if %{with valgrind}
BuildRequires: valgrind-devel
%endif
@ -139,9 +114,6 @@ BuildRequires: python3-setuptools
BuildRequires: python3-pip
%endif
Provides: python(abi) = %{dirver}
%if %{without py38}
Provides: python = %{EVRD}
%endif
%description
Python is an interpreted, interactive, object-oriented programming
@ -211,15 +183,15 @@ for the Python language.
#------------------------------------------------------------------------------
%package -n tkinter%{sub_ver}
%package -n tkinter3.11
Summary: A graphical user interface for the Python scripting language
Group: Development/Python
Requires: %{name} = %{EVRD}
Requires: tcl
Requires: tk
Provides: python%{sub_ver}-tkinter
Provides: python3.11-tkinter = %{EVRD}
%description -n tkinter%{sub_ver}
%description -n tkinter3.11
The Tkinter (Tk interface) program is an graphical user interface for
the Python scripting language.
@ -228,12 +200,12 @@ user interface for Python programming.
#------------------------------------------------------------------------------
%package -n tkinter%{sub_ver}-apps
%package -n tkinter3.11-apps
Summary: Various applications written using tkinter
Group: Development/Python
Requires: tkinter%{sub_ver}
Requires: tkinter3.11
%description -n tkinter%{sub_ver}-apps
%description -n tkinter3.11-apps
Various applications written using tkinter
#------------------------------------------------------------------------------
@ -242,10 +214,6 @@ Various applications written using tkinter
%setup -qn Python-%{version}
%autopatch -p1
%if "%{_lib}" != "lib64"
%patch102 -p1 -R
%endif
# drop Autoconf version requirement
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac
@ -278,6 +246,9 @@ autoreconf -vfi
--with-system-ffi \
--enable-shared \
--without-ensurepip \
--without-static-libpython \
--with-platlibdir=%{_lib} \
--with-ssl-default-suites=openssl \
%if %{with valgrind}
--with-valgrind
%endif
@ -304,31 +275,26 @@ echo 'install_dir='"${RPM_BUILD_ROOT}/usr/bin" >>setup.cfg
mkdir -p %{buildroot}%{_mandir}
%makeinstall_std LN="ln -sf"
# overwrite the copied binary with a link
pushd %{buildroot}%{_bindir}
#ln -sf python%{dirver}m python%{dirver}
ln -sf python%{dirver} python%{familyver}
popd
(cd %{buildroot}%{_libdir}; ln -sf `ls libpython%{lib_major}*.so.*` libpython%{lib_major}.so)
# install pynche as pynche3
cat << EOF > %{buildroot}%{_bindir}/pynche3
#!/bin/bash
exec %{_libdir}/python%{dirver}/site-packages/pynche/pynche
EOF
rm -f Tools/pynche/*.pyw
cp -r Tools/pynche %{buildroot}%{_libdir}/python%{dirver}/site-packages/
chmod 755 %{buildroot}%{_bindir}/{idle3,pynche3}
ln -f Tools/pynche/README Tools/pynche/README.pynche
%if %{with valgrind}
install Misc/valgrind-python.supp -D %{buildroot}%{_libdir}/valgrind/valgrind-python3.supp
%endif
mkdir -p %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/rosa-tkinter%{sub_ver}.desktop << EOF
cat > %{buildroot}%{_datadir}/applications/rosa-tkinter3.11.desktop << EOF
[Desktop Entry]
Name=IDLE
Name[ru]=IDLE
Comment=IDE for Python3
Comment[ru]=IDE для Python3
Exec=%{_bindir}/idle%{dirver}
Exec=%{_bindir}/idle3
Icon=development_environment_section
Terminal=false
Type=Application
@ -355,35 +321,26 @@ find %{buildroot} -type f \( -name "test_binascii.py*" -o -name "test_grp.py*" -
# fix python library not stripped
chmod u+w %{buildroot}%{_libdir}/libpython%{lib_major}*.so.1.0 %{buildroot}%{_libdir}/libpython3.so
%if %{without py38}
%install_macro python3 %{SOURCE2}
%else
%install_macro python38 %{SOURCE2}
%endif
%install_macro py38bytecompile %{SOURCE3}
ln -s python3 %{buildroot}%{_bindir}/python
ln -s pydoc3 %{buildroot}%{_bindir}/pydoc
ln -s python3-config %{buildroot}%{_bindir}/python-config
%install_macro python3.11 %{SOURCE2}
%install_macro py3.11bytecompile %{SOURCE3}
# Script to perform import of each module given to %%py_check_import
install -D -m644 %{SOURCE4} %{buildroot}%{_rpmconfigdir}/redhat/import_all_modules.py
# Install pathfix.py to bindir
# See https://github.com/fedora-python/python-rpm-porting/issues/24
cp -p Tools/scripts/pathfix.py %{buildroot}%{_bindir}/
%if %{with py38}
install -m0755 %{SOURCE4} %{buildroot}%{_bindir}/python38-shebang-sanity
mv %{buildroot}%{_bindir}/pynche3 \
%{buildroot}%{_bindir}/pynche%{sub_ver}
install -m0755 %{SOURCE5} %{buildroot}%{_bindir}/python3.11-shebang-sanity
# conflict with main python
[ -L %{buildroot}%{_mandir}/man1/python3.1 ] && rm -fv %{buildroot}%{_mandir}/man1/python3.1
[ -L %{buildroot}%{_mandir}/man1/python3.11 ] && rm -fv %{buildroot}%{_mandir}/man1/python3.11
# Build scripts of many packages try to use the highest version of Python that they find
# That is why we have to relocate python3.8 out of $PATH
mkdir -p %{buildroot}%{_libexecdir}
mv %{buildroot}%{_bindir}/python3.8 %{buildroot}%{_libexecdir}/python3.8
mv %{buildroot}%{_bindir}/python3.11 %{buildroot}%{_libexecdir}/python3.11
# Remove shebang lines from .py files that aren't executable, and
# remove executability from .py files that don't have a shebang line:
@ -393,15 +350,19 @@ find %{buildroot} -name \*.py \
-perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \
-exec chmod a-x {} \; \) \)
########## shebang py3 > py3.8 ##################
sh %{SOURCE4}
########## shebang py3 > py3.11 ##################
sh %{SOURCE5}
# When packaging a not system version of Python, these files are named like e.g. 2to3-3.8
# When packaging a not system version of Python, these files are named like e.g. 2to3-3.11
# These files must not be packaged to avoid conflicts with system python3
rm -fr %{buildroot}%{_bindir}/{2to3,idle3,pydoc,pydoc3,python,python3,python3-config,python-config}
rm -fr %{buildroot}%{_libdir}/libpython3.so
rm -fr %{buildroot}%{_libdir}/pkgconfig/python3.pc
%endif
rm -fr %{buildroot}%{_libdir}/pkgconfig/python3-embed.pc
# Fix permissions on docs
find html -type d -exec chmod 755 {} +
find html -type f -exec chmod 644 {} +
%check
# (misc) if the home is nfs mounted, rmdir fails
@ -415,15 +376,16 @@ export TMP="/tmp" TMPDIR="/tmp"
%files
%{_rpmmacrodir}/*python3*
%{_rpmmacrodir}/*py*bytecompile*
%{_rpmmacrodir}/*py3.11bytecompile*
%{_rpmconfigdir}/redhat/import_all_modules.py
%{_includedir}/python*/pyconfig.h
%{_libdir}/python*/config*/Makefile
%exclude %{_libdir}/python*/site-packages/pynche
%exclude %{_libdir}/python*/lib-dynload/_tkinter.*.so
%dir %{_libdir}/python*
%{_libdir}/python*/LICENSE.txt
%{_libdir}/python%{dirver}/*.py
%{_libdir}/python%{dirver}/__phello__
%{_libdir}/python%{dirver}/__pycache__
%{_libdir}/python%{dirver}/collections
%{_libdir}/python%{dirver}/concurrent
@ -442,8 +404,10 @@ export TMP="/tmp" TMPDIR="/tmp"
%{_libdir}/python%{dirver}/logging
%{_libdir}/python%{dirver}/multiprocessing
%{_libdir}/python%{dirver}/pydoc_data
%{_libdir}/python%{dirver}/re
%{_libdir}/python%{dirver}/site-packages
%{_libdir}/python%{dirver}/sqlite3
%{_libdir}/python%{dirver}/tomllib
%{_libdir}/python%{dirver}/turtledemo
%{_libdir}/python%{dirver}/unittest
%{_libdir}/python%{dirver}/urllib
@ -453,60 +417,27 @@ export TMP="/tmp" TMPDIR="/tmp"
%{_libdir}/python%{dirver}/xmlrpc
%{_libdir}/python%{dirver}/asyncio
%{_libdir}/python%{dirver}/ensurepip
# %exclude %{_libdir}/python%{dirver}/ensurepip/_bundled
%{_libdir}/python%{dirver}/zoneinfo
%{_bindir}/pathfix.py
%{_bindir}/pydoc3*
%{_bindir}/python3*
%if %rpm4
%if %{with py38}
%exclude %{_bindir}/pydoc
%exclude %{_bindir}/pydoc3
%exclude %{_bindir}/python
%exclude %{_bindir}/python3
%exclude %{_bindir}/2to3
%else
%{_bindir}/2to3
%{_bindir}/pydoc
%{_bindir}/python
%endif
%endif
%{_bindir}/python%{dirver}-shebang*
%{_bindir}/2to3-%{dirver}
# do not exclude it
# requires by systemtap
%if %{with py38}
%exclude %{_bindir}/python*config
%else
%{_bindir}/python*config
%endif
#%{_datadir}/emacs/site-lisp/*
%{_mandir}/man*/*
%if %{with valgrind}
%{_libdir}/valgrind/valgrind-python3.supp
%endif
%if %{with py38}
%{_libexecdir}/python3*
%endif
%files -n %{lib_name}
%{_libdir}/libpython*.so.1*
%files -n %{develname}
%if %rpm4
%if %{with py38}
%exclude %{_libdir}/libpython3.so
%exclude %{_libdir}/pkgconfig/python3.pc
%endif
%endif
%{_libdir}/libpython*.so
%{_libdir}/pkgconfig/python*.pc
%{_includedir}/python*
%{_libdir}/python*/config-*
%{_bindir}/python%{dirver}*-config
%if %{without py38}
%{_bindir}/python%{familyver}-config
%endif
%{_libdir}/python*/test/
#%{_libdir}/python*/config-*
%{_bindir}/python%{dirver}*-config
%{_libdir}/pkgconfig/*.pc
%exclude %{_includedir}/python*/pyconfig.h
%exclude %{_libdir}/python*/config*/Makefile
@ -514,20 +445,14 @@ export TMP="/tmp" TMPDIR="/tmp"
%doc html/*/*
%{_datadir}/applications/rosa-%{name}-docs.desktop
%files -n tkinter%{sub_ver}
%files -n tkinter3.11
%{_libdir}/python*/tkinter/
%{_libdir}/python*/idlelib
%{_libdir}/python*/site-packages/pynche
%{_libdir}/python*/lib-dynload/_tkinter.*.so
%files -n tkinter%{sub_ver}-apps
%if %rpm4
%if %{with py38}
%exclude %{_bindir}/idle3
%endif
%endif
%files -n tkinter3.11-apps
%{_bindir}/idle3*
%{_bindir}/pynche%{sub_ver}
%{_datadir}/applications/rosa-tkinter%{sub_ver}.desktop
%{_datadir}/applications/rosa-tkinter3.11.desktop

View file

@ -1,29 +0,0 @@
%__python38 /usr/libexec/python3.8
%python38_sitelib %(%{__python38} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python38_sitearch %(%{__python38} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
%python38_version %(%{__python38} -c "import sys; print(sys.version[0:3])")
%py38_ver %(%{__python38} -c "import sys; v=sys.version_info[:2]; print('%%d.%%d'%%v)" 2>/dev/null || echo PYTHON38-NOT-FOUND)
%py38_prefix %(%{__python38} -c "import sys; print(sys.prefix)" 2>/dev/null || echo PYTHON38-NOT-FOUND)
%py38_platsitedir %python38_sitearch
%py38_puresitedir %python38_sitelib
%py38_incdir %(%{__python38} -c 'from distutils.sysconfig import get_python_inc; print(get_python_inc())' 2>/dev/null || echo PYTHON38-INCLUDEDIR-NOT-FOUND)
%py38dir %{_builddir}/python38-%{name}-%{version}-%{release}
# %%py_setup setup.py # in rpm-openmandriva-setup
%py38_shbang_opts -s
%py38_build() %{expand:\
CFLAGS="%{optflags}" %{__python38} %{py_setup} %{?py_setup_args} build --executable="%{__python38} %{py38_shbang_opts}" %{?*}\
}
%py38_install() %{expand:\
CFLAGS="%{optflags}" %{__python38} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}\
}
%py38_test() %{expand:\
%{__python38} %{py_setup} %{?py_setup_args} test %{?1}\
}
%py38_shebang_sanity %{_bindir}/python38-shebang-sanity
%py38_ss %py38_shebang_sanity