From cf4938d5f6d2662fc6883d659cc51647bd2928d5 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Thu, 4 Jul 2024 07:27:32 +0200 Subject: [PATCH] python: Update to 3.12.4 * drop all distutils patches, distutils is gone * drop all setup.py patches, that's gone too * refresh the 32bit rebase (things changed, but I added it to the same make target, hopefully still works) * adjust the new module building code to depend on the import lib and also add the build dir to the library path so it can be found. * ctypes dropped vendored things, so remove code deleting it * the code printing a warning if a module build fails no longer exists, so drop the "tee" stuff and the error check there --- python/001-3.1-enable-new-dtags.patch | 13 ------ python/007-3.8-dbm-cygwin.patch | 11 ----- python/008-3.8-distutils-cygwin.patch | 32 ------------- python/012-3.8-pep3149-cygwin.patch | 17 ------- python/014-3.8-xxsubinterpreters-cygwin.patch | 11 ----- python/015-rpath.patch | 33 ------------- ...ler-customize-mingw-cygwin-compilers.patch | 28 ----------- python/900-msysize.patch | 46 ++----------------- python/950-rebase-dlls.patch | 16 +++---- python/980-fix-module-lib-dep.patch | 29 ++++++++++++ python/PKGBUILD | 41 +++++------------ 11 files changed, 52 insertions(+), 225 deletions(-) delete mode 100644 python/001-3.1-enable-new-dtags.patch delete mode 100644 python/007-3.8-dbm-cygwin.patch delete mode 100644 python/008-3.8-distutils-cygwin.patch delete mode 100644 python/014-3.8-xxsubinterpreters-cygwin.patch delete mode 100644 python/015-rpath.patch delete mode 100644 python/025-MINGW-compiler-customize-mingw-cygwin-compilers.patch create mode 100644 python/980-fix-module-lib-dep.patch diff --git a/python/001-3.1-enable-new-dtags.patch b/python/001-3.1-enable-new-dtags.patch deleted file mode 100644 index 38cd2097..00000000 --- a/python/001-3.1-enable-new-dtags.patch +++ /dev/null @@ -1,13 +0,0 @@ -Cygwin ld (as of binutils-2.19.51) does not understand --enable-new-dtags. - ---- Python-3.1-orig/Lib/distutils/unixccompiler.py 2009-05-09 06:55:12.000000000 -0500 -+++ Python-3.1/Lib/distutils/unixccompiler.py 2009-08-19 22:46:55.222993300 -0500 -@@ -279,7 +279,7 @@ class UnixCCompiler(CCompiler): - # the configuration data stored in the Python installation, so - # we use this hack. - compiler = os.path.basename(sysconfig.get_config_var("CC")) -- if sys.platform[:6] == "darwin": -+ if sys.platform[:6] == "darwin" or sys.platform[:6] == "cygwin": - # MacOSX's linker doesn't understand the -R flag at all - return "-L" + dir - elif sys.platform[:7] == "freebsd": diff --git a/python/007-3.8-dbm-cygwin.patch b/python/007-3.8-dbm-cygwin.patch deleted file mode 100644 index 4b8ab0a6..00000000 --- a/python/007-3.8-dbm-cygwin.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Python-3.8.0a3-orig/setup.py 2019-03-29 13:42:31.711914000 -0400 -+++ Python-3.8.0a3/setup.py 2019-03-29 13:40:09.958984300 -0400 -@@ -1208,7 +1208,7 @@ class PyBuildExt(build_ext): - dbm_setup_debug = False # verbose debug prints from this script? - dbm_order = ['gdbm'] - # The standard Unix dbm module: -- if not CYGWIN: -+ if not MS_WINDOWS: - config_args = [arg.strip("'") - for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] - dbm_args = [arg for arg in config_args diff --git a/python/008-3.8-distutils-cygwin.patch b/python/008-3.8-distutils-cygwin.patch deleted file mode 100644 index bf1f9276..00000000 --- a/python/008-3.8-distutils-cygwin.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- Python-3.8.0a4-orig/Lib/distutils/cygwinccompiler.py 2019-05-06 14:30:25.000000000 -0400 -+++ Python-3.8.0a4/Lib/distutils/cygwinccompiler.py 2019-05-19 14:35:55.872267300 -0400 -@@ -92,9 +92,7 @@ class CygwinCCompiler(UnixCCompiler): - compiler_type = 'cygwin' - obj_extension = ".o" - static_lib_extension = ".a" -- shared_lib_extension = ".dll" -- static_lib_format = "lib%s%s" -- shared_lib_format = "%s%s" -+ shared_lib_extension = ".dll.a" - exe_extension = ".exe" - - def __init__(self, verbose=0, dry_run=0, force=0): ---- Python-3.8.0a4-orig/Lib/distutils/unixccompiler.py 2019-05-19 14:24:27.779442200 -0400 -+++ Python-3.8.0a4/Lib/distutils/unixccompiler.py 2019-05-19 14:35:55.872267300 -0400 -@@ -81,6 +81,7 @@ class UnixCCompiler(CCompiler): - xcode_stub_lib_format = dylib_lib_format - if sys.platform == "cygwin": - exe_extension = ".exe" -+ dylib_lib_extension = ".dll.a" - - def preprocess(self, source, output_file=None, macros=None, - include_dirs=None, extra_preargs=None, extra_postargs=None): ---- Python-3.8.0b2-orig/Misc/python.pc.in 2019-07-04 06:50:19.000000000 -0400 -+++ Python-3.8.0b2/Misc/python.pc.in 2019-07-21 15:33:35.374399700 -0400 -@@ -9,5 +9,5 @@ Description: Build a C extension for Pyt - Requires: - Version: @VERSION@ - Libs.private: @LIBS@ --Libs: -+Libs: @LIBPYTHON@ - Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@ diff --git a/python/012-3.8-pep3149-cygwin.patch b/python/012-3.8-pep3149-cygwin.patch index 1838b999..7ce28f63 100644 --- a/python/012-3.8-pep3149-cygwin.patch +++ b/python/012-3.8-pep3149-cygwin.patch @@ -9,20 +9,3 @@ ".dll", #else /* !__CYGWIN__ */ "." SOABI ".so", ---- Python-3.11.2/configure.ac.orig 2023-02-13 19:44:27.282349300 +0100 -+++ Python-3.11.2/configure.ac 2023-02-13 20:30:23.784979600 +0100 -@@ -1057,6 +1057,14 @@ - darwin - #elif defined(__VXWORKS__) - vxworks -+#elif defined(__CYGWIN__) -+# if defined(__x86_64__) -+ x86_64-cygwin -+# elif defined(__i386__) -+ i386-cygwin -+# else -+# error unknown platform triplet -+# endif - #elif defined(__wasm32__) - # if defined(__EMSCRIPTEN__) - wasm32-emscripten diff --git a/python/014-3.8-xxsubinterpreters-cygwin.patch b/python/014-3.8-xxsubinterpreters-cygwin.patch deleted file mode 100644 index 0d250cda..00000000 --- a/python/014-3.8-xxsubinterpreters-cygwin.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Python-3.8.0a3-orig/Modules/_xxsubinterpretersmodule.c 2019-03-25 15:36:40.000000000 -0400 -+++ Python-3.8.0a3/Modules/_xxsubinterpretersmodule.c 2019-03-29 13:33:54.880859300 -0400 -@@ -1735,7 +1735,7 @@ PyDoc_STRVAR(channelid_doc, - "A channel ID identifies a channel and may be used as an int."); - - static PyTypeObject ChannelIDtype = { -- PyVarObject_HEAD_INIT(&PyType_Type, 0) -+ PyVarObject_HEAD_INIT(NULL, 0) - "_xxsubinterpreters.ChannelID", /* tp_name */ - sizeof(channelid), /* tp_basicsize */ - 0, /* tp_itemsize */ diff --git a/python/015-rpath.patch b/python/015-rpath.patch deleted file mode 100644 index 5731d5a2..00000000 --- a/python/015-rpath.patch +++ /dev/null @@ -1,33 +0,0 @@ -From bf01d6c367d9cb8f6594afa87c16f0498ae7321f Mon Sep 17 00:00:00 2001 -From: David Malcolm -Date: Wed, 13 Jan 2010 21:25:18 +0000 -Subject: [PATCH] 00001: Fixup distutils/unixccompiler.py to remove standard - library path from rpath Was Patch0 in ivazquez' python3000 specfile - ---- - Lib/distutils/unixccompiler.py | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py -index d10a78da31..4df4b67810 100644 ---- a/Lib/distutils/unixccompiler.py -+++ b/Lib/distutils/unixccompiler.py -@@ -82,6 +82,15 @@ class UnixCCompiler(CCompiler): - if sys.platform == "cygwin": - exe_extension = ".exe" - -+ def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs): -+ """Remove standard library path from rpath""" -+ libraries, library_dirs, runtime_library_dirs = super()._fix_lib_args( -+ libraries, library_dirs, runtime_library_dirs) -+ libdir = sysconfig.get_config_var('LIBDIR') -+ if runtime_library_dirs and (libdir in runtime_library_dirs): -+ runtime_library_dirs.remove(libdir) -+ return libraries, library_dirs, runtime_library_dirs -+ - def preprocess(self, source, output_file=None, macros=None, - include_dirs=None, extra_preargs=None, extra_postargs=None): - fixed_args = self._fix_compile_args(None, macros, include_dirs) --- -2.24.1 - diff --git a/python/025-MINGW-compiler-customize-mingw-cygwin-compilers.patch b/python/025-MINGW-compiler-customize-mingw-cygwin-compilers.patch deleted file mode 100644 index 10cce032..00000000 --- a/python/025-MINGW-compiler-customize-mingw-cygwin-compilers.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -urN a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py ---- a/Lib/distutils/sysconfig.py 2014-10-11 14:19:27.487874300 +0100 -+++ b/Lib/distutils/sysconfig.py 2014-10-11 14:19:30.049020800 +0100 -@@ -156,7 +156,23 @@ - Mainly needed on Unix, so we can plug in the information that - varies across Unices and is stored in Python's Makefile. - """ -- if compiler.compiler_type == "unix": -+ global _config_vars -+ if compiler.compiler_type in ["cygwin", "mingw32"]: -+ # Note that cygwin use posix build and 'unix' compiler. -+ # If build is not based on posix then we must predefine -+ # some environment variables corresponding to posix -+ # build rules and defaults. -+ if not 'GCC' in sys.version: -+ _config_vars['CC'] = "gcc" -+ _config_vars['CXX'] = "g++" -+ _config_vars['OPT'] = "-fwrapv -O3 -Wall -Wstrict-prototypes" -+ _config_vars['CFLAGS'] = "" -+ _config_vars['CCSHARED'] = "" -+ _config_vars['LDSHARED'] = "gcc -shared -Wl,--enable-auto-image-base" -+ _config_vars['AR'] = "ar" -+ _config_vars['ARFLAGS'] = "rc" -+ -+ if compiler.compiler_type in ["unix", "cygwin", "mingw32"]: - if sys.platform == "darwin": - # Perform first-time customization of compiler-related - # config vars on OS X now that we know we need a compiler. diff --git a/python/900-msysize.patch b/python/900-msysize.patch index 645f5640..041f827b 100644 --- a/python/900-msysize.patch +++ b/python/900-msysize.patch @@ -1,20 +1,5 @@ --- Python-3.8.7.cygwin/configure.ac 2021-05-11 21:07:52.839122100 +0200 +++ Python-3.8.7/configure.ac 2021-05-11 21:10:48.366063600 +0200 -@@ -845,6 +845,14 @@ - darwin - #elif defined(__VXWORKS__) - vxworks -+#elif defined(__MSYS__) -+# if defined(__x86_64__) -+ x86_64-msys -+# elif defined(__i386__) -+ i386-msys -+# else -+# error unknown platform triplet -+# endif - #elif defined(__CYGWIN__) - # if defined(__x86_64__) - x86_64-cygwin @@ -1137,7 +1148,7 @@ case $ac_sys_system in CYGWIN*) @@ -35,9 +20,9 @@ else: pythonapi = PyDLL(None) ---- Python-3.8.7.orig/Lib/ctypes/test/test_loading.py 2020-12-21 17:25:24.000000000 +0100 -+++ Python-3.8.7/Lib/ctypes/test/test_loading.py 2021-05-11 22:27:51.108283400 +0200 -@@ -15,7 +15,7 @@ +--- Python-3.12.4/Lib/test/test_ctypes/test_loading.py.orig 2024-06-06 20:26:44.000000000 +0200 ++++ Python-3.12.4/Lib/test/test_ctypes/test_loading.py 2024-07-04 07:35:25.827763700 +0200 +@@ -16,7 +16,7 @@ if os.name == "nt": libc_name = find_library("c") elif sys.platform == "cygwin": @@ -59,31 +44,6 @@ print(find_library("crypt")) else: print(cdll.LoadLibrary("libm.so")) -diff -Naur Python-3.8.2-orig/Lib/distutils/cygwinccompiler.py Python-3.8.2/Lib/distutils/cygwinccompiler.py ---- Python-3.8.2-orig/Lib/distutils/cygwinccompiler.py 2020-04-16 11:05:52.457414700 +0300 -+++ Python-3.8.2/Lib/distutils/cygwinccompiler.py 2020-04-16 11:24:20.464492200 +0300 -@@ -400,4 +400,4 @@ - def is_cygwingcc(): - '''Try to determine if the gcc that would be used is from cygwin.''' - out_string = check_output(['gcc', '-dumpmachine']) -- return out_string.strip().endswith(b'cygwin') -+ return (out_string.strip().endswith(b'cygwin') or out_string.strip().endswith(b'msys')) -diff -Naur Python-3.8.2-orig/Lib/distutils/util.py Python-3.8.2/Lib/distutils/util.py ---- Python-3.8.2-orig/Lib/distutils/util.py 2020-02-25 00:36:25.000000000 +0300 -+++ Python-3.8.2/Lib/distutils/util.py 2020-04-16 11:24:20.569211200 +0300 -@@ -86,6 +86,12 @@ - m = rel_re.match(release) - if m: - release = m.group() -+ elif osname[:4] == "msys": -+ osname = "msys" -+ rel_re = re.compile (r'[\d.]+', re.ASCII) -+ m = rel_re.match(release) -+ if m: -+ release = m.group() - elif osname[:6] == "darwin": - import _osx_support, distutils.sysconfig - osname, release, machine = _osx_support.get_platform_osx( diff -Naur Python-3.8.2-orig/Lib/sysconfig.py Python-3.8.2/Lib/sysconfig.py --- Python-3.8.2-orig/Lib/sysconfig.py 2020-02-25 00:36:25.000000000 +0300 +++ Python-3.8.2/Lib/sysconfig.py 2020-04-16 11:24:20.643039800 +0300 diff --git a/python/950-rebase-dlls.patch b/python/950-rebase-dlls.patch index 53bd137d..af2ad353 100644 --- a/python/950-rebase-dlls.patch +++ b/python/950-rebase-dlls.patch @@ -1,10 +1,10 @@ ---- Python-3.8.5/Makefile.pre.in.orig 2020-08-13 17:35:32.636969100 -0700 -+++ Python-3.8.5/Makefile.pre.in 2020-08-13 23:24:10.054938400 -0700 -@@ -609,6 +609,7 @@ - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build +--- Python-3.12.4/Makefile.pre.in.orig 2024-07-04 07:37:58.547224000 +0200 ++++ Python-3.12.4/Makefile.pre.in 2024-07-04 07:41:07.755948400 +0200 +@@ -995,6 +995,7 @@ + $(LN) -sf ../../$$mod $$target/`basename $$mod`; \ + fi; \ + done + [[ `uname -m` == i?86 ]] && find . -name \*.dll | rebase -sOT - || true - libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS) - if test $(INSTSONAME) != $(LDLIBRARY); then \ + # dependency on BUILDPYTHON ensures that the target is run last + .PHONY: checksharedmods diff --git a/python/980-fix-module-lib-dep.patch b/python/980-fix-module-lib-dep.patch new file mode 100644 index 00000000..6f270b43 --- /dev/null +++ b/python/980-fix-module-lib-dep.patch @@ -0,0 +1,29 @@ +--- Python-3.12.4/Modules/makesetup.orig 2024-06-06 20:26:44.000000000 +0200 ++++ Python-3.12.4/Modules/makesetup 2024-07-05 21:08:47.722675100 +0200 +@@ -90,13 +90,10 @@ + # Setup to link with extra libraries when making shared extensions. + # Currently, only Cygwin needs this baggage. + case `uname -s` in +-CYGWIN*) if test $libdir = . +- then +- ExtraLibDir=. +- else +- ExtraLibDir='$(LIBPL)' +- fi +- ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)";; ++CYGWIN*) ++ ExtraLibDir=. ++ ExtraLibs="-L$ExtraLibDir -lpython\$(LDVERSION)" ++ ExtraLibDepends='$(LIBRARY_DEPS)';; + esac + + # Main loop +@@ -285,7 +282,7 @@ + BUILT_SHARED="$BUILT_SHARED $mod" + ;; + esac +- rule="$file: $objs" ++ rule="$file: $objs $ExtraLibDepends" + rule="$rule; \$(BLDSHARED) $objs $libs $ExtraLibs -o $file" + echo "$rule" >>$rulesf + done diff --git a/python/PKGBUILD b/python/PKGBUILD index 3b7b9938..bc542e44 100644 --- a/python/PKGBUILD +++ b/python/PKGBUILD @@ -3,7 +3,7 @@ pkgbase=python pkgname=('python' 'python-devel') -pkgver=3.11.9 +pkgver=3.12.4 pkgrel=1 _pybasever=${pkgver%.*} pkgdesc="Next generation of the python high-level scripting language" @@ -31,39 +31,29 @@ makedepends=( 'gcc' ) source=(https://www.python.org/ftp/python/${pkgver%rc*}/Python-${pkgver}.tar.xz - 001-3.1-enable-new-dtags.patch 003-3.4-select-cygwin.patch 005-3.7-ctypes-cygwin.patch - 007-3.8-dbm-cygwin.patch - 008-3.8-distutils-cygwin.patch 009-3.8-export-PySignal_SetWakeupFd.patch 012-3.8-pep3149-cygwin.patch - 014-3.8-xxsubinterpreters-cygwin.patch - 015-rpath.patch - 025-MINGW-compiler-customize-mingw-cygwin-compilers.patch 027-install-import-library.patch 900-msysize.patch 920-allow-win-drives-in-os-path-isabs.patch 940-rebase-python-dll.patch 950-rebase-dlls.patch - 970-ossaudiodev.patch) -sha256sums=('9b1e896523fc510691126c864406d9360a3d1e986acbda59cda57b5abda45b87' - 'be96ddaca58a39ddaf1e3e5bb7900b34c0e6d00e9b64c4e0f8a3565a74a44e84' + 970-ossaudiodev.patch + 980-fix-module-lib-dep.patch) +sha256sums=('f6d419a6d8743ab26700801b4908d26d97e8b986e14f95de31b32de2b0e79554' '82cfafc5b31ad4c9bb4c9786044c39c75762dbc2656abdfdc433c23fee69c02f' 'f0bb75ca69c63894fc43e0f8218c9dbcc746935bf5ea095a724e6fb2f5dcc566' - 'dc044b0651a67f7c76e4119d65085e42277c0513b8e9653f0972d955c3dde2c5' - '8c460bf9522e50e06aa2c21a921eb42543d7a4cac6c598b13be43940a96966bf' '70f854f00de71372e49f2ebbff7491e09e9e036e8e3f3646fe2984e30fb4a9da' - 'e3d3f4f8b653ddd7eec305d7af43928c070d409bcf7f1b59269d59545c8f1862' - 'e48c719be36cb266ac3ceae834739fb1faae6740524cd672fd367f9304894a39' - '437332e1a7195dd0adcd505ecdeab5c3a7a793efdd7fea7bec55f97957bb8934' - '3e6c115c9b8e044193c0524b94275dfb13c1adfba3d250131b065f632b6d5512' + 'a407491301d1aa186a6b1815fc18f4f4da22b489c49b31b58125debbf9d9d3a1' '9d0efb7e7e913e96b9f7953802311bbc2d046a7bfdcc3ffaf11fc509731b4d18' - '5dfed4be015e93ab6f4e99a69fc5b3eece9c801ea504c8d0517c3cb6bb7dbe89' + '7ca289727bf714cccfe075c959f4907cf527b3e1d251020c9f0e8b21a2f1f365' '85d9d042e0fa3493ec54b364e6b4fb6d2b12ba09641e01047bc84a09605ef76b' 'b439ff4f0a1f13858f8fb596414b74ed2c14fc3103d90287bb8e461ee89288b9' - '612bc5bcbe24c2f623713172d318c65a69ae601d72bcc5a170fe7c4eee458d18' - 'ee109d91a1c7ea84d278d9a8b0e1feb397e691b8868d79f77ea7bb6b1b3b1968') + 'bcdb4e7922e30f7dfbd3993ffe6db2dfd0df29326bebd12203dce376ea3451d9' + 'ee109d91a1c7ea84d278d9a8b0e1feb397e691b8868d79f77ea7bb6b1b3b1968' + 'e2861218f05741bfe99b05bb41cf88e14f57747aedec251626691b05482a50bd') apply_patch_with_msg() { for _patch in "$@" @@ -77,27 +67,21 @@ prepare() { cd "${srcdir}/Python-${pkgver}" apply_patch_with_msg \ - 001-3.1-enable-new-dtags.patch \ 003-3.4-select-cygwin.patch \ 005-3.7-ctypes-cygwin.patch \ - 007-3.8-dbm-cygwin.patch \ - 008-3.8-distutils-cygwin.patch \ 009-3.8-export-PySignal_SetWakeupFd.patch \ 012-3.8-pep3149-cygwin.patch \ - 014-3.8-xxsubinterpreters-cygwin.patch \ - 015-rpath.patch \ - 025-MINGW-compiler-customize-mingw-cygwin-compilers.patch \ 027-install-import-library.patch \ 900-msysize.patch \ 920-allow-win-drives-in-os-path-isabs.patch \ 940-rebase-python-dll.patch \ 950-rebase-dlls.patch \ - 970-ossaudiodev.patch + 970-ossaudiodev.patch \ + 980-fix-module-lib-dep.patch # Ensure that we are using the system copy of various libraries (expat, zlib and libffi), # rather than copies shipped in the tarball rm -r Modules/expat - rm -r Modules/_ctypes/{darwin,libffi}* rm -r Modules/_decimal/libmpdec autoreconf -fiv } @@ -122,8 +106,7 @@ build() { --enable-loadable-sqlite-extensions \ --without-ensurepip - make > >(tee make-python.log) - sed -ne '/^\s*Failed to build these modules/,$ {p; /^\s*$/q42}' make-python.log + make } check() {