diff --git a/packages/lang/Python3/package.mk b/packages/lang/Python3/package.mk index ff43f92eb4..a94947dd92 100644 --- a/packages/lang/Python3/package.mk +++ b/packages/lang/Python3/package.mk @@ -3,8 +3,8 @@ PKG_NAME="Python3" # When changing PKG_VERSION remember to sync PKG_PYTHON_VERSION! -PKG_VERSION="3.11.9" -PKG_SHA256="9b1e896523fc510691126c864406d9360a3d1e986acbda59cda57b5abda45b87" +PKG_VERSION="3.12.5" +PKG_SHA256="fa8a2e12c5e620b09f53e65bcd87550d2e5a1e2e04bf8ba991dcc55113876397" PKG_LICENSE="OSS" PKG_SITE="https://www.python.org/" PKG_URL="https://www.python.org/ftp/python/${PKG_VERSION}/${PKG_NAME::-1}-${PKG_VERSION}.tar.xz" @@ -13,18 +13,23 @@ PKG_DEPENDS_TARGET="autotools:host gcc:host Python3:host sqlite expat zlib bzip2 PKG_LONGDESC="Python3 is an interpreted object-oriented programming language." PKG_TOOLCHAIN="autotools" -PKG_PYTHON_VERSION="python3.11" - -PKG_PY_DISABLED_MODULES="_tkinter nis gdbm bsddb ossaudiodev" +PKG_PYTHON_VERSION="python3.12" PKG_CONFIGURE_OPTS_HOST="ac_cv_prog_HAS_HG=/bin/false ac_cv_prog_SVNVERSION=/bin/false + py_cv_module_unicodedata=yes + py_cv_module__codecs_cn=n/a + py_cv_module__codecs_hk=n/a + py_cv_module__codecs_iso2022=n/a + py_cv_module__codecs_jp=n/a + py_cv_module__codecs_kr=n/a + py_cv_module__codecs_tw=n/a + py_cv_module_nis=n/a + py_cv_module_ossaudiodev=n/a + py_cv_module__dbm=n/a + py_cv_module__gdbm=n/a --disable-pyc-build - --disable-ossaudiodev --disable-sqlite3 - --disable-codecs-cjk - --disable-nis - --enable-unicodedata --enable-openssl --disable-readline --disable-bzip2 @@ -57,12 +62,18 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_prog_HAS_HG=/bin/false ac_cv_buggy_getaddrinfo=no ac_cv_header_bluetooth_bluetooth_h=no ac_cv_header_bluetooth_h=no + py_cv_module_unicodedata=yes + py_cv_module__codecs_cn=n/a + py_cv_module__codecs_hk=n/a + py_cv_module__codecs_iso2022=n/a + py_cv_module__codecs_jp=n/a + py_cv_module__codecs_kr=n/a + py_cv_module__codecs_tw=n/a + py_cv_module_nis=n/a + py_cv_module_ossaudiodev=n/a + py_cv_module__dbm=n/a --disable-pyc-build - --disable-ossaudiodev --enable-sqlite3 - --disable-codecs-cjk - --disable-nis - --enable-unicodedata --enable-openssl --enable-readline --enable-bzip2 @@ -86,9 +97,6 @@ PKG_CONFIGURE_OPTS_TARGET="ac_cv_prog_HAS_HG=/bin/false " pre_configure_host() { - export PYTHON_MODULES_INCLUDE="${HOST_INCDIR}" - export PYTHON_MODULES_LIB="${HOST_LIBDIR}" - export DISABLED_EXTENSIONS="readline _curses _curses_panel ${PKG_PY_DISABLED_MODULES}" # control patch Python3-0300-generate-legacy-pyc-bytecode # this needs to be set when building host based py file # do not set this for py compiles being done for target use @@ -103,19 +111,7 @@ post_make_host() { post_makeinstall_host() { ln -sf ${PKG_PYTHON_VERSION} ${TOOLCHAIN}/bin/python - rm -f ${TOOLCHAIN}/bin/smtpd.py* - rm -f ${TOOLCHAIN}/bin/pyvenv - rm -f ${TOOLCHAIN}/bin/pydoc* - rm -fr ${PKG_BUILD}/.${HOST_NAME}/build/temp.* - - cp ${PKG_BUILD}/Tools/scripts/reindent.py ${TOOLCHAIN}/lib/${PKG_PYTHON_VERSION} -} - -pre_configure_target() { - export PYTHON_MODULES_INCLUDE="${TARGET_INCDIR}" - export PYTHON_MODULES_LIB="${TARGET_LIBDIR}" - export DISABLED_EXTENSIONS="${PKG_PY_DISABLED_MODULES}" } post_make_target() { @@ -136,11 +132,7 @@ post_makeinstall_target() { rm -rf ${PKG_INSTALL_PATH_LIB}/${dir} done - rm -rf ${PKG_INSTALL_PATH_LIB}/distutils/command/*.exe - - rm -rf ${INSTALL}/usr/bin/pyvenv - rm -rf ${INSTALL}/usr/bin/python*-config - rm -rf ${INSTALL}/usr/bin/smtpd.py ${INSTALL}/usr/bin/smtpd.py.* + safe_remove ${INSTALL}/usr/bin/python*-config find ${INSTALL} -name '*.o' -delete diff --git a/packages/lang/Python3/patches/0001-Make-the-build-of-pyc-files-conditional.patch b/packages/lang/Python3/patches/0001-Make-the-build-of-pyc-files-conditional.patch index 92aa7274ba..b35b06216c 100644 --- a/packages/lang/Python3/patches/0001-Make-the-build-of-pyc-files-conditional.patch +++ b/packages/lang/Python3/patches/0001-Make-the-build-of-pyc-files-conditional.patch @@ -1,4 +1,4 @@ -From 51ed7f93cc0333efa8fccd9b88db713c48993df9 Mon Sep 17 00:00:00 2001 +From 5d0f69ce7fc05adbd3c71e113c11da0aedbca33a Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Wed, 22 Feb 2017 16:21:31 -0800 Subject: [PATCH] Make the build of pyc files conditional @@ -9,38 +9,40 @@ the compilation of pyc. Signed-off-by: Thomas Petazzoni [ Andrey Smrinov: ported to Python 3.6 ] Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.12.0 ] +Signed-off-by: Adam Duskett --- Makefile.pre.in | 2 ++ configure.ac | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Makefile.pre.in b/Makefile.pre.in -index 8fbcd7ac17..2957c8e5a1 100644 +index 4a957fb004..9c5f3c031a 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -2078,6 +2078,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c - $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ - $(DESTDIR)$(LIBDEST)/distutils/tests ; \ - fi +@@ -2329,6 +2329,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c + $(DESTDIR)$(LIBDEST); \ + $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt + @ # Build PYC files for the 3 optimization levels (0, 1, 2) +ifeq (@PYC_BUILD@,yes) - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ - -j0 -d $(LIBDEST) -f \ -@@ -2105,6 +2106,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c - $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ - -j0 -d $(LIBDEST)/site-packages -f \ + -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST) -f \ +@@ -2338,6 +2339,7 @@ libinstall: all $(srcdir)/Modules/xxmodule.c + $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ + -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +endif -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ diff --git a/configure.ac b/configure.ac -index ab5e1de6fa..0cf89ed641 100644 +index 8a32cb58f4..611c33949a 100644 --- a/configure.ac +++ b/configure.ac -@@ -1441,6 +1441,12 @@ fi +@@ -1479,6 +1479,12 @@ fi - AC_MSG_CHECKING(LDLIBRARY) + AC_MSG_CHECKING([LDLIBRARY]) +AC_SUBST(PYC_BUILD) + diff --git a/packages/lang/Python3/patches/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch b/packages/lang/Python3/patches/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch index 5389cb5d15..e774e442dc 100644 --- a/packages/lang/Python3/patches/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch +++ b/packages/lang/Python3/patches/0002-Disable-buggy_getaddrinfo-configure-test-when-cross-.patch @@ -1,4 +1,4 @@ -From b180ab302e2a82be239af334382436628b81381e Mon Sep 17 00:00:00 2001 +From 3a0d7824f7ddd4dd0336c8419cb4246ba936d711 Mon Sep 17 00:00:00 2001 From: Vanya Sergeev Date: Wed, 23 Dec 2015 11:30:33 +0100 Subject: [PATCH] Disable buggy_getaddrinfo configure test when cross-compiling @@ -10,10 +10,10 @@ Signed-off-by: Vanya Sergeev 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index 0cf89ed641..830885fcb3 100644 +index 611c33949a..059ac2f883 100644 --- a/configure.ac +++ b/configure.ac -@@ -5086,7 +5086,7 @@ fi])) +@@ -5428,7 +5428,7 @@ fi])) dnl if ac_cv_func_getaddrinfo ]) diff --git a/packages/lang/Python3/patches/0003-Add-an-option-to-disable-pydoc.patch b/packages/lang/Python3/patches/0003-Add-an-option-to-disable-pydoc.patch new file mode 100644 index 0000000000..01ce235afd --- /dev/null +++ b/packages/lang/Python3/patches/0003-Add-an-option-to-disable-pydoc.patch @@ -0,0 +1,84 @@ +From f910bdee70b07792c136aaced3850a08eaaafdee Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:07:56 -0800 +Subject: [PATCH] Add an option to disable pydoc + +It removes 0.5 MB of data from the target plus the pydoc script +itself. + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.10.0 ] +Signed-off-by: Adam Duskett +[ Adam Duskett: ported to Python 3.12.1 ] +Signed-off-by: Adam Duskett +--- + Makefile.pre.in | 9 ++++++++- + configure.ac | 6 ++++++ + 2 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 9c5f3c031a..2243a658a9 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -2050,7 +2050,9 @@ bininstall: commoninstall altbininstall + -rm -f $(DESTDIR)$(BINDIR)/idle3 + (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) + -rm -f $(DESTDIR)$(BINDIR)/pydoc3 ++ifeq (@PYDOC@,yes) + (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) ++endif + -rm -f $(DESTDIR)$(BINDIR)/2to3 + (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3) + if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ +@@ -2102,7 +2104,6 @@ LIBSUBDIRS= asyncio \ + lib2to3 lib2to3/fixes lib2to3/pgen2 \ + logging \ + multiprocessing multiprocessing/dummy \ +- pydoc_data \ + re \ + site-packages \ + sqlite3 \ +@@ -2257,6 +2258,10 @@ TESTSUBDIRS= idlelib/idle_test \ + + COMPILEALL_OPTS=-j0 + ++ifeq (@PYDOC@,yes) ++LIBSUBDIRS += pydoc_data ++endif ++ + TEST_MODULES=@TEST_MODULES@ + + .PHONY: libinstall +@@ -2471,7 +2476,9 @@ libainstall: all scripts + $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config + $(INSTALL_SCRIPT) $(SCRIPT_2TO3) $(DESTDIR)$(BINDIR)/2to3-$(VERSION) + $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION) ++ifeq (@PYDOC@,yes) + $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION) ++endif + @if [ -s Modules/python.exp -a \ + "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ + echo; echo "Installing support files for building shared extension modules on AIX:"; \ +diff --git a/configure.ac b/configure.ac +index 059ac2f883..1a2dd28d1e 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4511,6 +4511,12 @@ AS_VAR_IF([posix_threads], [stub], [ + AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support]) + ]) + ++AC_SUBST(PYDOC) ++ ++AC_ARG_ENABLE(pydoc, ++ AS_HELP_STRING([--disable-pydoc], [disable pydoc]), ++ [ PYDOC="${enableval}" ], [ PYDOC=yes ]) ++ + # Check for enable-ipv6 + AH_TEMPLATE([ENABLE_IPV6], [Define if --enable-ipv6 is specified]) + AC_MSG_CHECKING([if --enable-ipv6 is specified]) +-- +2.34.1 + diff --git a/packages/lang/Python3/patches/0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch b/packages/lang/Python3/patches/0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch deleted file mode 100644 index 5b3911374e..0000000000 --- a/packages/lang/Python3/patches/0003-Add-infrastructure-to-disable-the-build-of-certain-e.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 8e02cebdac536dfb6748da2c50656a26f70d9da7 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 22 Feb 2017 16:33:22 -0800 -Subject: [PATCH] Add infrastructure to disable the build of certain extensions - -Some of the extensions part of the Python core have dependencies on -external libraries (sqlite, tk, etc.) or are relatively big and not -necessarly always useful (CJK codecs for example). By extensions, we -mean part of Python modules that are written in C and therefore -compiled to binary code. - -Therefore, we introduce a small infrastructure that allows to disable -some of those extensions. This can be done inside the configure.ac by -adding values to the DISABLED_EXTENSIONS variable (which is a -word-separated list of extensions). - -The implementation works as follow : - - * configure.ac defines a DISABLED_EXTENSIONS variable, which is - substituted (so that when Makefile.pre is generated from - Makefile.pre.in, the value of the variable is substituted). For - now, this DISABLED_EXTENSIONS variable is empty, later patches will - use it. - - * Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the - variables passed in the environment when calling the setup.py - script that actually builds and installs those extensions. - - * setup.py is modified so that the existing "disabled_module_list" is - filled with those pre-disabled extensions listed in - DISABLED_EXTENSIONS. - -Patch ported to python2.7 by Maxime Ripard , and -then extended by Thomas Petazzoni -. - -Signed-off-by: Thomas Petazzoni -[ Andrey Smirnov: ported to Python 3.6 ] -Signed-off-by: Andrey Smirnov ---- - Makefile.pre.in | 6 +++++- - configure.ac | 2 ++ - setup.py | 5 ++++- - 3 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/Makefile.pre.in b/Makefile.pre.in -index 2957c8e5a1..c1cfb96767 100644 ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -239,6 +239,8 @@ FILEMODE= 644 - # configure script arguments - CONFIG_ARGS= @CONFIG_ARGS@ - -+# disabled extensions -+DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@ - - # Subdirectories with code - SRCDIRS= @SRCDIRS@ -@@ -739,6 +741,7 @@ sharedmods: $(PYTHON_FOR_BUILD_DEPS) pybuilddir.txt @LIBMPDEC_INTERNAL@ @LIBEXPA - *) quiet="";; \ - esac; \ - echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build -@@ -2228,7 +2231,8 @@ libainstall: all python-config - # Install the dynamically loadable modules - # This goes into $(exec_prefix) - sharedinstall: all -- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ -+ $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ -+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ - --prefix=$(prefix) \ - --install-scripts=$(BINDIR) \ - --install-platlib=$(DESTSHARED) \ -diff --git a/configure.ac b/configure.ac -index 830885fcb3..5a6a1fe608 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -3562,6 +3562,8 @@ LIBS="$withval $LIBS" - ], - [AC_MSG_RESULT(no)]) - -+AC_SUBST(DISABLED_EXTENSIONS) -+ - # Check for use of the system expat library - AC_MSG_CHECKING(for --with-system-expat) - AC_ARG_WITH(system_expat, -diff --git a/setup.py b/setup.py -index 15d0d4576a..e496ee34c2 100644 ---- a/setup.py -+++ b/setup.py -@@ -56,7 +56,10 @@ - - - # This global variable is used to hold the list of modules to be disabled. --DISABLED_MODULE_LIST = [] -+try: -+ DISABLED_MODULE_LIST = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ") -+except KeyError: -+ DISABLED_MODULE_LIST = list() - - # --list-module-names option used by Tools/scripts/generate_module_names.py - LIST_MODULE_NAMES = False --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0012-Add-an-option-to-disable-lib2to3.patch b/packages/lang/Python3/patches/0004-Add-an-option-to-disable-lib2to3.patch similarity index 54% rename from packages/lang/Python3/patches/0012-Add-an-option-to-disable-lib2to3.patch rename to packages/lang/Python3/patches/0004-Add-an-option-to-disable-lib2to3.patch index a41a6cfa47..cc21cbd0b5 100644 --- a/packages/lang/Python3/patches/0012-Add-an-option-to-disable-lib2to3.patch +++ b/packages/lang/Python3/patches/0004-Add-an-option-to-disable-lib2to3.patch @@ -1,4 +1,4 @@ -From 0e4f0a525ea0a68f6d4c5349c301da2e9b0c8ac9 Mon Sep 17 00:00:00 2001 +From 572f3164d1dce13db30e897ab0be7c706fa7b731 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Wed, 22 Feb 2017 17:15:31 -0800 Subject: [PATCH] Add an option to disable lib2to3 @@ -12,17 +12,20 @@ Signed-off-by: Samuel Martin Signed-off-by: Andrey Smirnov [ Adam Duskett: ported to Python 3.10.0 ] Signed-off-by: Adam Duskett +[ Bernd Kuhls: ported to Python 3.11.4] +Signed-off-by: Bernd Kuhls +[ Adam Duskett: ported to Python 3.12.1 ] +Signed-off-by: Adam Duskett --- - Makefile.pre.in | 17 ++++++++++++----- + Makefile.pre.in | 19 ++++++++++++++----- configure.ac | 6 ++++++ - setup.py | 6 +++--- - 3 files changed, 21 insertions(+), 8 deletions(-) + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in -index 403380e181..f5d0573067 100644 +index 2243a658a9..3f314d1354 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -1868,7 +1868,9 @@ ifeq (@PYDOC@,yes) +@@ -2054,7 +2054,9 @@ ifeq (@PYDOC@,yes) (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) endif -rm -f $(DESTDIR)$(BINDIR)/2to3 @@ -32,7 +35,7 @@ index 403380e181..f5d0573067 100644 if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \ (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \ -@@ -1914,7 +1916,6 @@ LIBSUBDIRS= asyncio \ +@@ -2101,7 +2103,6 @@ LIBSUBDIRS= asyncio \ idlelib idlelib/Icons \ importlib importlib/resources importlib/metadata \ json \ @@ -40,34 +43,34 @@ index 403380e181..f5d0573067 100644 logging \ multiprocessing multiprocessing/dummy \ re \ -@@ -1934,10 +1935,6 @@ LIBSUBDIRS= asyncio \ - TESTSUBDIRS= ctypes/test \ - distutils/tests \ - idlelib/idle_test \ -- lib2to3/tests \ -- lib2to3/tests/data \ -- lib2to3/tests/data/fixers \ -- lib2to3/tests/data/fixers/myfixes \ - test \ - test/audiodata \ - test/capath \ -@@ -2013,6 +2010,14 @@ ifeq (@PYDOC@,yes) +@@ -2207,10 +2208,6 @@ TESTSUBDIRS= idlelib/idle_test \ + test/test_importlib/resources/zipdata02 \ + test/test_importlib/source \ + test/test_json \ +- test/test_lib2to3 \ +- test/test_lib2to3/data \ +- test/test_lib2to3/data/fixers \ +- test/test_lib2to3/data/fixers/myfixes \ + test/test_module \ + test/test_peg_generator \ + test/test_pydoc \ +@@ -2262,6 +2259,14 @@ ifeq (@PYDOC@,yes) LIBSUBDIRS += pydoc_data endif +ifeq (@LIB2TO3@,yes) +LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 -+TESTSUBDIRS += lib2to3/tests \ -+ lib2to3/tests/data \ -+ lib2to3/tests/data/fixers \ -+ lib2to3/tests/data/fixers/myfixes ++TESTSUBDIRS += test/test_lib2to3 \ ++ test/test_lib2to3/data \ ++ test/test_lib2to3/data/fixers \ ++ test/test_lib2to3/data/fixers/myfixes +endif + TEST_MODULES=@TEST_MODULES@ - libinstall: all $(srcdir)/Modules/xxmodule.c - @for i in $(SCRIPTDIR) $(LIBDEST); \ -@@ -2115,10 +2120,12 @@ ifeq (@PYC_BUILD@,yes) - -j0 -d $(LIBDEST)/site-packages -f \ + + .PHONY: libinstall +@@ -2345,10 +2350,12 @@ ifeq (@PYC_BUILD@,yes) + -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages endif +ifeq (@LIB2TO3@,yes) @@ -79,11 +82,21 @@ index 403380e181..f5d0573067 100644 # bpo-21536: Misc/python-config.sh is generated in the build directory # from $(srcdir)Misc/python-config.sh.in. +@@ -2474,7 +2481,9 @@ libainstall: all scripts + $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh + $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py + $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config ++ifeq (@LIB2TO3@,yes) + $(INSTALL_SCRIPT) $(SCRIPT_2TO3) $(DESTDIR)$(BINDIR)/2to3-$(VERSION) ++endif + $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION) + ifeq (@PYDOC@,yes) + $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION) diff --git a/configure.ac b/configure.ac -index f68ea72321..d8e10cf2b2 100644 +index 1a2dd28d1e..f0354c580d 100644 --- a/configure.ac +++ b/configure.ac -@@ -7078,6 +7078,12 @@ PY_STDLIB_MOD([xxlimited_35], [test "$with_trace_refs" = "no"], [test "$ac_cv_fu +@@ -7561,6 +7561,12 @@ PY_STDLIB_MOD([xxlimited_35], [test "$with_trace_refs" = "no"], [test "$ac_cv_fu # substitute multiline block, must come after last PY_STDLIB_MOD() AC_SUBST([MODULE_BLOCK]) @@ -94,27 +107,8 @@ index f68ea72321..d8e10cf2b2 100644 + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ]) + # generate output files - AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh) - AC_CONFIG_FILES([Modules/Setup.bootstrap Modules/Setup.stdlib]) -diff --git a/setup.py b/setup.py -index 3e55f5b2e0..c490b0b08f 100644 ---- a/setup.py -+++ b/setup.py -@@ -1594,11 +1594,11 @@ class DummyProcess: - import warnings - warnings.filterwarnings("ignore",category=DeprecationWarning) - -- scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3', -- 'Lib/smtpd.py'] -+ scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py'] - if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): - scripts += [ 'Tools/scripts/pydoc3' ] -- -+ if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"): -+ scripts += [ 'Tools/scripts/2to3' ] - setup(# PyPI Metadata (PEP 301) - name = "Python", - version = sys.version.split()[0], + AC_CONFIG_FILES(m4_normalize([ + Makefile.pre -- 2.34.1 diff --git a/packages/lang/Python3/patches/0004-Adjust-library-header-paths-for-cross-compilation.patch b/packages/lang/Python3/patches/0004-Adjust-library-header-paths-for-cross-compilation.patch deleted file mode 100644 index 9a55d2582d..0000000000 --- a/packages/lang/Python3/patches/0004-Adjust-library-header-paths-for-cross-compilation.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 132b9dca3bb4d4682f7e318648ce11e1abb31b62 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 23 Dec 2015 11:33:14 +0100 -Subject: [PATCH] Adjust library/header paths for cross-compilation - -When cross-compiling third-party extensions, the get_python_inc() or -get_python_lib() can be called, to return the path to headers or -libraries. However, they use the sys.prefix of the host Python, which -returns incorrect paths when cross-compiling (paths pointing to host -headers and libraries). - -In order to fix this, we introduce the _python_sysroot, _python_prefix -and _python_exec_prefix variables, that allow to override these -values, and get correct header/library paths when cross-compiling -third-party Python modules. - -Signed-off-by: Thomas Petazzoni -Signed-off-by: Adam Duskett -Refresh for 3.10.0 ---- - Lib/distutils/command/build_ext.py | 5 ++++- - Lib/sysconfig.py | 15 +++++++++++---- - 2 files changed, 15 insertions(+), 5 deletions(-) - -diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py -index f287b34998..298234d6a1 100644 ---- a/Lib/distutils/command/build_ext.py -+++ b/Lib/distutils/command/build_ext.py -@@ -234,7 +234,10 @@ def finalize_options(self): - if (sysconfig.get_config_var('Py_ENABLE_SHARED')): - if not sysconfig.python_build: - # building third party extensions -- self.library_dirs.append(sysconfig.get_config_var('LIBDIR')) -+ libdir = sysconfig.get_config_var('LIBDIR') -+ if "_python_sysroot" in os.environ: -+ libdir = os.environ.get("_python_sysroot") + libdir -+ self.library_dirs.append(libdir) - else: - # building python standard extensions - self.library_dirs.append('.') -diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py -index ebe3711827..6328ec41af 100644 ---- a/Lib/sysconfig.py -+++ b/Lib/sysconfig.py -@@ -168,10 +168,17 @@ def joinuser(*args): - _PY_VERSION = sys.version.split()[0] - _PY_VERSION_SHORT = f'{sys.version_info[0]}.{sys.version_info[1]}' - _PY_VERSION_SHORT_NO_DOT = f'{sys.version_info[0]}{sys.version_info[1]}' --_PREFIX = os.path.normpath(sys.prefix) --_BASE_PREFIX = os.path.normpath(sys.base_prefix) --_EXEC_PREFIX = os.path.normpath(sys.exec_prefix) --_BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) -+if "_python_sysroot" in os.environ: -+ _sysroot=os.environ.get('_python_sysroot') -+ _PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix')) -+ _EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix')) -+ _BASE_PREFIX = _PREFIX -+ _BASE_EXEC_PREFIX = _EXEC_PREFIX -+else: -+ _PREFIX = os.path.normpath(sys.prefix) -+ _EXEC_PREFIX = os.path.normpath(sys.exec_prefix) -+ _BASE_PREFIX = os.path.normpath(sys.base_prefix) -+ _BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix) - _CONFIG_VARS = None - _USER_BASE = None - --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0020-Add-an-option-to-disable-IDLE.patch b/packages/lang/Python3/patches/0005-Add-an-option-to-disable-IDLE.patch similarity index 52% rename from packages/lang/Python3/patches/0020-Add-an-option-to-disable-IDLE.patch rename to packages/lang/Python3/patches/0005-Add-an-option-to-disable-IDLE.patch index 09b5f13cdb..e9218af1c8 100644 --- a/packages/lang/Python3/patches/0020-Add-an-option-to-disable-IDLE.patch +++ b/packages/lang/Python3/patches/0005-Add-an-option-to-disable-IDLE.patch @@ -1,4 +1,4 @@ -From 2c9dbd6d49744aa8da8ebf8d0187d6b06f93c2b5 Mon Sep 17 00:00:00 2001 +From ffa7fbceb54918eb518474c8f821fda0a58cf181 Mon Sep 17 00:00:00 2001 From: Maxime Ripard Date: Wed, 22 Feb 2017 17:45:14 -0800 Subject: [PATCH] Add an option to disable IDLE @@ -11,17 +11,18 @@ Signed-off-by: Maxime Ripard Signed-off-by: Andrey Smirnov [ Adam Duskett: ported to Python 3.10.0 ] Signed-off-by: Adam Duskett +[ Adam Duskett: ported to Python 3.12.1 ] +Signed-off-by: Adam Duskett --- - Makefile.pre.in | 7 ++++++- + Makefile.pre.in | 9 ++++++++- configure.ac | 6 ++++++ - setup.py | 5 ++++- - 3 files changed, 16 insertions(+), 2 deletions(-) + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile.pre.in b/Makefile.pre.in -index 80d617cf7f..8d1ba1356c 100644 +index 3f314d1354..5fad7f82fb 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -1862,7 +1862,9 @@ bininstall: altbininstall +@@ -2048,7 +2048,9 @@ bininstall: commoninstall altbininstall -rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc (cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc) -rm -f $(DESTDIR)$(BINDIR)/idle3 @@ -31,7 +32,7 @@ index 80d617cf7f..8d1ba1356c 100644 -rm -f $(DESTDIR)$(BINDIR)/pydoc3 ifeq (@PYDOC@,yes) (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) -@@ -1912,7 +1914,6 @@ LIBSUBDIRS= asyncio \ +@@ -2100,7 +2102,6 @@ LIBSUBDIRS= asyncio \ ensurepip ensurepip/_bundled \ html \ http \ @@ -39,8 +40,8 @@ index 80d617cf7f..8d1ba1356c 100644 importlib importlib/resources importlib/metadata \ json \ logging \ -@@ -2030,6 +2031,10 @@ ifeq (@EXPAT@,yes) - LIBSUBDIRS += $(XMLLIBSUBDIRS) +@@ -2267,6 +2268,10 @@ TESTSUBDIRS += test/test_lib2to3 \ + test/test_lib2to3/data/fixers/myfixes endif +ifeq (@IDLE@,yes) @@ -48,13 +49,23 @@ index 80d617cf7f..8d1ba1356c 100644 +endif + TEST_MODULES=@TEST_MODULES@ - libinstall: all $(srcdir)/Modules/xxmodule.c - @for i in $(SCRIPTDIR) $(LIBDEST); \ + + .PHONY: libinstall +@@ -2484,7 +2489,9 @@ libainstall: all scripts + ifeq (@LIB2TO3@,yes) + $(INSTALL_SCRIPT) $(SCRIPT_2TO3) $(DESTDIR)$(BINDIR)/2to3-$(VERSION) + endif ++ifeq (@IDLE@,yes) + $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION) ++endif + ifeq (@PYDOC@,yes) + $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION) + endif diff --git a/configure.ac b/configure.ac -index ba4b0e0c1c..5e6d72f7db 100644 +index f0354c580d..43086962e9 100644 --- a/configure.ac +++ b/configure.ac -@@ -7137,6 +7137,12 @@ AC_ARG_ENABLE(lib2to3, +@@ -7567,6 +7567,12 @@ AC_ARG_ENABLE(lib2to3, AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]), [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ]) @@ -65,28 +76,8 @@ index ba4b0e0c1c..5e6d72f7db 100644 + [ IDLE="${enableval}" ], [ IDLE=yes ]) + # generate output files - AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh) - AC_CONFIG_FILES([Modules/Setup.bootstrap Modules/Setup.stdlib]) -diff --git a/setup.py b/setup.py -index c490b0b08f..4d49a792f7 100644 ---- a/setup.py -+++ b/setup.py -@@ -1594,11 +1594,14 @@ class DummyProcess: - import warnings - warnings.filterwarnings("ignore",category=DeprecationWarning) - -- scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py'] -+ scripts = [ 'Lib/smtpd.py'] - if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): - scripts += [ 'Tools/scripts/pydoc3' ] - if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"): - scripts += [ 'Tools/scripts/2to3' ] -+ if not '--disable-idle3' in sysconfig.get_config_var("CONFIG_ARGS"): -+ scripts += [ 'Tools/scripts/idle3' ] -+ - setup(# PyPI Metadata (PEP 301) - name = "Python", - version = sys.version.split()[0], + AC_CONFIG_FILES(m4_normalize([ + Makefile.pre -- 2.34.1 diff --git a/packages/lang/Python3/patches/0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch b/packages/lang/Python3/patches/0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch deleted file mode 100644 index 78b3ae596d..0000000000 --- a/packages/lang/Python3/patches/0005-Don-t-look-in-usr-lib-termcap-for-libraries.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 5d13e384b30a2c0b1c7b65718590b7fb0c3ba55e Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 23 Dec 2015 11:36:00 +0100 -Subject: [PATCH] Don't look in /usr/lib/termcap for libraries - -Signed-off-by: Thomas Petazzoni ---- - setup.py | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/setup.py b/setup.py -index e496ee34c2..1904898165 100644 ---- a/setup.py -+++ b/setup.py -@@ -1107,12 +1107,9 @@ def detect_readline_curses(self): - pass # Issue 7384: Already linked against curses or tinfo. - elif curses_library: - readline_libs.append(curses_library) -- elif self.compiler.find_library_file(self.lib_dirs + -- ['/usr/lib/termcap'], -- 'termcap'): -+ elif self.compiler.find_library_file(self.lib_dirs, 'termcap'): - readline_libs.append('termcap') - self.add(Extension('readline', ['readline.c'], -- library_dirs=['/usr/lib/termcap'], - libraries=readline_libs)) - else: - self.missing.append('readline') --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0006-Don-t-add-multiarch-paths.patch b/packages/lang/Python3/patches/0006-Don-t-add-multiarch-paths.patch deleted file mode 100644 index 749e295df1..0000000000 --- a/packages/lang/Python3/patches/0006-Don-t-add-multiarch-paths.patch +++ /dev/null @@ -1,37 +0,0 @@ -From ad463b5d58ae79f69b011fb048861bd874d34369 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 23 Dec 2015 11:36:27 +0100 -Subject: [PATCH] Don't add multiarch paths - -The add_multiarch_paths() function leads, in certain build -environments, to the addition of host header paths to the CFLAGS, -which is not appropriate for cross-compilation. This patch fixes that -by simply removing the call to add_multiarch_paths() when we're -cross-compiling. - -Investigation done by David . - -Signed-off-by: Thomas Petazzoni ---- - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/setup.py b/setup.py -index 1904898165..32294546b6 100644 ---- a/setup.py -+++ b/setup.py -@@ -852,10 +852,10 @@ def configure_compiler(self): - if not CROSS_COMPILING: - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') -+ self.add_multiarch_paths() - # only change this for cross builds for 3.3, issues on Mageia - if CROSS_COMPILING: - self.add_cross_compiling_paths() -- self.add_multiarch_paths() - self.add_ldflags_cppflags() - - def init_inc_lib_dirs(self): --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0006-configure.ac-move-PY_STDLIB_MOD_SET_NA-further-up.patch b/packages/lang/Python3/patches/0006-configure.ac-move-PY_STDLIB_MOD_SET_NA-further-up.patch new file mode 100644 index 0000000000..e594e6cd63 --- /dev/null +++ b/packages/lang/Python3/patches/0006-configure.ac-move-PY_STDLIB_MOD_SET_NA-further-up.patch @@ -0,0 +1,44 @@ +From 267516c76208e63b5a3ec7d4dead6c329d8763bb Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 6 Feb 2024 22:46:59 +0100 +Subject: [PATCH] configure.ac: move PY_STDLIB_MOD_SET_NA further up + +We will need PY_STDLIB_MOD_SET_NA in next patches further up in the +configure.ac script. + +Signed-off-by: Thomas Petazzoni +--- + configure.ac | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 43086962e9..561e33f550 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -95,6 +95,11 @@ AC_DEFUN([PY_CHECK_EMSCRIPTEN_PORT], [ + AS_VAR_POPDEF([py_libs]) + ]) + ++AC_DEFUN([PY_STDLIB_MOD_SET_NA], [ ++ m4_foreach([mod], [$@], [ ++ AS_VAR_SET([py_cv_module_]mod, [n/a])]) ++]) ++ + AC_SUBST([BASECPPFLAGS]) + if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then + # If we're building out-of-tree, we need to make sure the following +@@ -7258,11 +7263,6 @@ AC_ARG_ENABLE([test-modules], + AC_MSG_RESULT([$TEST_MODULES]) + AC_SUBST([TEST_MODULES]) + +-AC_DEFUN([PY_STDLIB_MOD_SET_NA], [ +- m4_foreach([mod], [$@], [ +- AS_VAR_SET([py_cv_module_]mod, [n/a])]) +-]) +- + # stdlib not available + dnl Modules that are not available on some platforms + dnl AIX has shadow passwords, but access is not via getspent() +-- +2.34.1 + diff --git a/packages/lang/Python3/patches/0007-Abort-on-failed-module-build.patch b/packages/lang/Python3/patches/0007-Abort-on-failed-module-build.patch deleted file mode 100644 index a473896127..0000000000 --- a/packages/lang/Python3/patches/0007-Abort-on-failed-module-build.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 60b1664a7acebadb1a3d6df871145147f33b5afe Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 23 Dec 2015 11:43:24 +0100 -Subject: [PATCH] Abort on failed module build - -When building a Python module fails, the setup.py script currently -doesn't exit with an error, and simply continues. This is not a really -nice behavior, so this patch changes setup.py to abort with an error, -so that the build issue is clearly noticeable. - -Signed-off-by: Thomas Petazzoni ---- - setup.py | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/setup.py b/setup.py -index 32294546b6..0e04944ce0 100644 ---- a/setup.py -+++ b/setup.py -@@ -579,6 +579,7 @@ def print_three_column(lst): - print("Failed to build these modules:") - print_three_column(failed) - print() -+ sys.exit(1) - - if self.failed_on_import: - failed = self.failed_on_import[:] --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0013-Add-option-to-disable-the-sqlite3-module.patch b/packages/lang/Python3/patches/0007-Add-option-to-disable-the-sqlite3-module.patch similarity index 61% rename from packages/lang/Python3/patches/0013-Add-option-to-disable-the-sqlite3-module.patch rename to packages/lang/Python3/patches/0007-Add-option-to-disable-the-sqlite3-module.patch index 795ea3b898..f26091ebfb 100644 --- a/packages/lang/Python3/patches/0013-Add-option-to-disable-the-sqlite3-module.patch +++ b/packages/lang/Python3/patches/0007-Add-option-to-disable-the-sqlite3-module.patch @@ -1,6 +1,6 @@ -From ef8c030e01b1be8be582e90c31298a5863094858 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 22 Feb 2017 17:20:45 -0800 +From a8566f6ee2a2b859ba5562f2d9f06cb4d271f277 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Tue, 6 Feb 2024 22:12:20 +0100 Subject: [PATCH] Add option to disable the sqlite3 module Signed-off-by: Thomas Petazzoni @@ -9,16 +9,17 @@ Signed-off-by: Samuel Martin Signed-off-by: Andrey Smirnov [ Adam Duskett: ported to Python 3.10.0 ] Signed-off-by: Adam Duskett +Signed-off-by: Thomas Petazzoni --- Makefile.pre.in | 5 ++++- - configure.ac | 9 +++++++++ - 2 files changed, 13 insertions(+), 1 deletion(-) + configure.ac | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile.pre.in b/Makefile.pre.in -index f5d0573067..9f4cdf14cf 100644 +index 5fad7f82fb..7b6c9811a6 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -1920,7 +1920,6 @@ LIBSUBDIRS= asyncio \ +@@ -2108,7 +2108,6 @@ LIBSUBDIRS= asyncio \ multiprocessing multiprocessing/dummy \ re \ site-packages \ @@ -26,8 +27,8 @@ index f5d0573067..9f4cdf14cf 100644 tkinter \ tomllib \ turtledemo \ -@@ -2018,6 +2017,10 @@ TESTSUBDIRS += lib2to3/tests \ - lib2to3/tests/data/fixers/myfixes +@@ -2272,6 +2271,10 @@ ifeq (@IDLE@,yes) + LIBSUBDIRS += idlelib idlelib/Icons endif +ifeq (@SQLITE3@,yes) @@ -35,13 +36,13 @@ index f5d0573067..9f4cdf14cf 100644 +endif + TEST_MODULES=@TEST_MODULES@ - libinstall: all $(srcdir)/Modules/xxmodule.c - @for i in $(SCRIPTDIR) $(LIBDEST); \ + + .PHONY: libinstall diff --git a/configure.ac b/configure.ac -index d8e10cf2b2..4cc0951ab9 100644 +index 561e33f550..d1c54bd67c 100644 --- a/configure.ac +++ b/configure.ac -@@ -4171,6 +4171,15 @@ AS_VAR_IF([posix_threads], [stub], [ +@@ -4516,6 +4516,13 @@ AS_VAR_IF([posix_threads], [stub], [ AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support]) ]) @@ -49,10 +50,8 @@ index d8e10cf2b2..4cc0951ab9 100644 +AC_ARG_ENABLE(sqlite3, + AS_HELP_STRING([--disable-sqlite3], [disable sqlite3]), + [ SQLITE3="${enableval}" ], [ SQLITE3=yes ]) -+ -+if test "$SQLITE3" = "no" ; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3" -+fi ++AS_IF([test "$SQLITE3" = "no"], ++ [PY_STDLIB_MOD_SET_NA([_sqlite3])]) + AC_SUBST(PYDOC) diff --git a/packages/lang/Python3/patches/0008-Add-an-option-to-disable-the-tk-module.patch b/packages/lang/Python3/patches/0008-Add-an-option-to-disable-the-tk-module.patch new file mode 100644 index 0000000000..97ee2d717c --- /dev/null +++ b/packages/lang/Python3/patches/0008-Add-an-option-to-disable-the-tk-module.patch @@ -0,0 +1,81 @@ +From c1ec9fa46cd7679fd009f66a3ebed8de95d84f10 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Wed, 22 Feb 2017 17:23:42 -0800 +Subject: [PATCH] Add an option to disable the tk module + +Signed-off-by: Thomas Petazzoni +Signed-off-by: Samuel Martin +[ Andrey Smirnov: ported to Python 3.6 ] +Signed-off-by: Andrey Smirnov +[ Adam Duskett: ported to Python 3.10.0 ] +Signed-off-by: Adam Duskett +[ Bernd Kuhls: ported to Python 3.11.4] +Signed-off-by: Bernd Kuhls +[ Adam Duskett: ported to Python 3.12.1 ] +Signed-off-by: Adam Duskett +--- + Makefile.pre.in | 8 +++++--- + configure.ac | 7 +++++++ + 2 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 7b6c9811a6..6d9527ddd0 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -2108,7 +2108,6 @@ LIBSUBDIRS= asyncio \ + multiprocessing multiprocessing/dummy \ + re \ + site-packages \ +- tkinter \ + tomllib \ + turtledemo \ + unittest \ +@@ -2212,7 +2211,6 @@ TESTSUBDIRS= idlelib/idle_test \ + test/test_peg_generator \ + test/test_pydoc \ + test/test_sqlite3 \ +- test/test_tkinter \ + test/test_tomllib \ + test/test_tomllib/data \ + test/test_tomllib/data/invalid \ +@@ -2232,7 +2230,6 @@ TESTSUBDIRS= idlelib/idle_test \ + test/test_tomllib/data/valid/dates-and-times \ + test/test_tomllib/data/valid/multiline-basic-str \ + test/test_tools \ +- test/test_ttk \ + test/test_unittest \ + test/test_unittest/testmock \ + test/test_warnings \ +@@ -2253,6 +2250,11 @@ TESTSUBDIRS= idlelib/idle_test \ + test/test_multiprocessing_forkserver \ + test/test_multiprocessing_spawn + ++ifeq (@TK@,yes) ++LIBSUBDIRS += tkinter ++TESTSUBDIRS += test/test_tkinter test/test_ttk ++endif ++ + COMPILEALL_OPTS=-j0 + + ifeq (@PYDOC@,yes) +diff --git a/configure.ac b/configure.ac +index d1c54bd67c..4c5cbe4153 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -4529,6 +4529,13 @@ AC_ARG_ENABLE(pydoc, + AS_HELP_STRING([--disable-pydoc], [disable pydoc]), + [ PYDOC="${enableval}" ], [ PYDOC=yes ]) + ++AC_SUBST(TK) ++AC_ARG_ENABLE(tk, ++ AS_HELP_STRING([--disable-tk], [disable tk]), ++ [ TK="${enableval}" ], [ TK=yes ]) ++AS_IF([test "$TK" = "no"], ++ [PY_STDLIB_MOD_SET_NA([_tkinter])]) ++ + # Check for enable-ipv6 + AH_TEMPLATE([ENABLE_IPV6], [Define if --enable-ipv6 is specified]) + AC_MSG_CHECKING([if --enable-ipv6 is specified]) +-- +2.34.1 + diff --git a/packages/lang/Python3/patches/0008-Serial-ioctl-workaround.patch b/packages/lang/Python3/patches/0008-Serial-ioctl-workaround.patch deleted file mode 100644 index 7722a04f38..0000000000 --- a/packages/lang/Python3/patches/0008-Serial-ioctl-workaround.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 90f3075b629d90d942da1d22ef7563f7149f4f6c Mon Sep 17 00:00:00 2001 -From: Baruch Siach -Date: Wed, 23 Dec 2015 11:44:02 +0100 -Subject: [PATCH] Serial ioctl() workaround - -The ioctls.h of some architectures (notably xtensa) references structs from -linux/serial.h. Make sure to include this header as well. - -Also, undef TIOCTTYGSTRUCT that require reference to internal kernel tty_struct, -but isn't actually referenced in modern kernels. - -Signed-off-by: Baruch Siach ---- - Modules/termios.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Modules/termios.c b/Modules/termios.c -index 354e5ca18d..c08957c500 100644 ---- a/Modules/termios.c -+++ b/Modules/termios.c -@@ -15,7 +15,9 @@ - #endif - - #include -+#include - #include -+#undef TIOCTTYGSTRUCT - - /* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR, - * MDTR, MRI, and MRTS (apparently used internally by some things --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0015-Add-an-option-to-disable-the-curses-module.patch b/packages/lang/Python3/patches/0009-Add-an-option-to-disable-the-curses-module.patch similarity index 58% rename from packages/lang/Python3/patches/0015-Add-an-option-to-disable-the-curses-module.patch rename to packages/lang/Python3/patches/0009-Add-an-option-to-disable-the-curses-module.patch index da6f891104..139bf1544b 100644 --- a/packages/lang/Python3/patches/0015-Add-an-option-to-disable-the-curses-module.patch +++ b/packages/lang/Python3/patches/0009-Add-an-option-to-disable-the-curses-module.patch @@ -1,4 +1,4 @@ -From 03e28cdd46dac1b7e4e9c8bbd2ea44b09e514205 Mon Sep 17 00:00:00 2001 +From d7ea122e8ae506019761b92987b141fe7ea55f76 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Wed, 22 Feb 2017 17:31:51 -0800 Subject: [PATCH] Add an option to disable the curses module @@ -10,48 +10,47 @@ Signed-off-by: Andrey Smirnov [ Adam Duskett: ported to Python 3.10.0 ] Signed-off-by: Adam Duskett --- - Makefile.pre.in | 4 +++- - configure.ac | 9 +++++++++ - 2 files changed, 12 insertions(+), 1 deletion(-) + Makefile.pre.in | 5 ++++- + configure.ac | 7 +++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile.pre.in b/Makefile.pre.in -index 4f83911200..8e879b35c6 100644 +index 6d9527ddd0..283ca1bd60 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -1905,7 +1905,6 @@ LIBSUBDIRS= asyncio \ +@@ -2095,7 +2095,6 @@ LIBSUBDIRS= asyncio \ concurrent concurrent/futures \ csv \ ctypes ctypes/macholib \ - curses \ dbm \ - distutils distutils/command \ email email/mime \ -@@ -2024,6 +2023,9 @@ TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \ - tkinter/test/test_ttk + encodings \ +@@ -2255,6 +2254,10 @@ LIBSUBDIRS += tkinter + TESTSUBDIRS += test/test_tkinter test/test_ttk endif +ifeq (@CURSES@,yes) +LIBSUBDIRS += curses +endif ++ + COMPILEALL_OPTS=-j0 - TEST_MODULES=@TEST_MODULES@ - libinstall: all $(srcdir)/Modules/xxmodule.c + ifeq (@PYDOC@,yes) diff --git a/configure.ac b/configure.ac -index f4ce506801..0ae9863cd6 100644 +index 4c5cbe4153..92d663ed40 100644 --- a/configure.ac +++ b/configure.ac -@@ -4189,6 +4189,15 @@ if test "$TK" = "no"; then - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter" - fi +@@ -4523,6 +4523,13 @@ AC_ARG_ENABLE(sqlite3, + AS_IF([test "$SQLITE3" = "no"], + [PY_STDLIB_MOD_SET_NA([_sqlite3])]) +AC_SUBST(CURSES) +AC_ARG_ENABLE(curses, + AS_HELP_STRING([--disable-curses], [disable curses]), + [ CURSES="${enableval}" ], [ CURSES=yes ]) -+ -+if test "$CURSES" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel" -+fi ++AS_IF([test "$CURSES" = "no"], ++ [PY_STDLIB_MOD_SET_NA([_curses], [_curses_panel])]) + AC_SUBST(PYDOC) diff --git a/packages/lang/Python3/patches/0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch b/packages/lang/Python3/patches/0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch deleted file mode 100644 index eff8fc7694..0000000000 --- a/packages/lang/Python3/patches/0009-Do-not-adjust-the-shebang-of-Python-scripts-for-cros.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 2439bd2ed5dbdd7e5fda15adefd0f6f1b047ec1b Mon Sep 17 00:00:00 2001 -From: Christophe Vu-Brugier -Date: Wed, 23 Dec 2015 11:44:30 +0100 -Subject: [PATCH] Do not adjust the shebang of Python scripts for - cross-compilation - -The copy_scripts() method in distutils copies the scripts listed in -the setup file and adjusts the first line to refer to the current -Python interpreter. When cross-compiling, this means that the adjusted -shebang refers to the host Python interpreter. - -This patch modifies copy_scripts() to preserve the shebang when -cross-compilation is detected. - -Signed-off-by: Christophe Vu-Brugier ---- - Lib/distutils/command/build_scripts.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py -index ccc70e6465..d6d54195c1 100644 ---- a/Lib/distutils/command/build_scripts.py -+++ b/Lib/distutils/command/build_scripts.py -@@ -91,7 +91,7 @@ def copy_scripts(self): - adjust = True - post_interp = match.group(1) or b'' - -- if adjust: -+ if adjust and not '_python_sysroot' in os.environ: - log.info("copying and adjusting %s -> %s", script, - self.build_dir) - updated_files.append(outfile) --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0016-Add-an-option-to-disable-expat.patch b/packages/lang/Python3/patches/0010-Add-an-option-to-disable-expat.patch similarity index 63% rename from packages/lang/Python3/patches/0016-Add-an-option-to-disable-expat.patch rename to packages/lang/Python3/patches/0010-Add-an-option-to-disable-expat.patch index c30740762a..2363aeb01d 100644 --- a/packages/lang/Python3/patches/0016-Add-an-option-to-disable-expat.patch +++ b/packages/lang/Python3/patches/0010-Add-an-option-to-disable-expat.patch @@ -1,4 +1,4 @@ -From c9a2ea3edacf57746517600ccc11c254a9fd6c48 Mon Sep 17 00:00:00 2001 +From d1701f1c89e9d2319ede200052319183fbb4ae18 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Wed, 22 Feb 2017 17:40:45 -0800 Subject: [PATCH] Add an option to disable expat @@ -17,23 +17,23 @@ Signed-off-by: Andrey Smirnov Signed-off-by: Adam Duskett --- Makefile.pre.in | 5 ++++- - configure.ac | 20 ++++++++++++++------ - 2 files changed, 18 insertions(+), 7 deletions(-) + configure.ac | 24 +++++++++++++----------- + 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in -index 8e879b35c6..80d617cf7f 100644 +index 283ca1bd60..13f7512f42 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in -@@ -1925,7 +1925,6 @@ LIBSUBDIRS= asyncio \ +@@ -2113,7 +2113,6 @@ LIBSUBDIRS= asyncio \ urllib \ venv venv/scripts venv/scripts/common venv/scripts/posix \ wsgiref \ - $(XMLLIBSUBDIRS) \ xmlrpc \ + zipfile zipfile/_path \ zoneinfo \ - __phello__ -@@ -2027,6 +2026,10 @@ ifeq (@CURSES@,yes) - LIBSUBDIRS += curses +@@ -2280,6 +2279,10 @@ ifeq (@SQLITE3@,yes) + LIBSUBDIRS += sqlite3 endif +ifeq (@EXPAT@,yes) @@ -41,36 +41,37 @@ index 8e879b35c6..80d617cf7f 100644 +endif + TEST_MODULES=@TEST_MODULES@ - libinstall: all $(srcdir)/Modules/xxmodule.c - @for i in $(SCRIPTDIR) $(LIBDEST); \ + + .PHONY: libinstall diff --git a/configure.ac b/configure.ac -index 0ae9863cd6..201cad0bfc 100644 +index 92d663ed40..1cb95f41fd 100644 --- a/configure.ac +++ b/configure.ac -@@ -3565,15 +3565,23 @@ LIBS="$withval $LIBS" - AC_SUBST(DISABLED_EXTENSIONS) +@@ -3823,17 +3823,19 @@ LIBS="$withval $LIBS" + [AC_MSG_RESULT([no])]) # Check for use of the system expat library --AC_MSG_CHECKING(for --with-system-expat) --AC_ARG_WITH(system_expat, -- AS_HELP_STRING([--with-system-expat], [build pyexpat module using an installed expat library, see Doc/library/pyexpat.rst (default is no)]), +-AC_MSG_CHECKING([for --with-system-expat]) +-AC_ARG_WITH( +- [system_expat], +- [AS_HELP_STRING( +- [--with-system-expat], +- [build pyexpat module using an installed expat library, see Doc/library/pyexpat.rst (default is no)] +- )], [], [with_system_expat="no"]) +- +-AC_MSG_RESULT([$with_system_expat]) +- +-AS_VAR_IF([with_system_expat], [yes], [ +AC_MSG_CHECKING(for --with-expat) +AC_ARG_WITH(expat, + AS_HELP_STRING([--with-expat], [select which expat version to use: system, builtin, none]), - [], -- [with_system_expat="no"]) ++ [], + [with_expat="builtin"]) - --AC_MSG_RESULT($with_system_expat) +AC_MSG_RESULT($with_expat) - --AS_VAR_IF([with_system_expat], [yes], [ -+if test "$with_expat" != "none"; then -+ EXPAT=yes -+else -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} pyexpat" -+ EXPAT=no -+fi ++AS_IF([test "$with_expat" != "none"], ++ [EXPAT=yes], ++ [PY_STDLIB_MOD_SET_NA([pyexpat]) ++ EXPAT=no]) +AC_SUBST(EXPAT) + +AS_VAR_IF([with_expat], [system], [ diff --git a/packages/lang/Python3/patches/0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch b/packages/lang/Python3/patches/0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch deleted file mode 100644 index f26ee85b61..0000000000 --- a/packages/lang/Python3/patches/0010-Misc-python-config.sh.in-ensure-sed-invocations-only.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 55ef5552e4ee60266e3299f253bec3b13785e585 Mon Sep 17 00:00:00 2001 -From: Peter Korsgaard -Date: Thu, 20 Nov 2014 13:24:59 +0100 -Subject: [PATCH] Misc/python-config.sh.in: ensure sed invocations only match - beginning of strings - -The build/real prefix handling using sed breaks if build != real and the -standard include / lib directories are used ($prefix/include and $prefix/lib). - -E.G. - -prefix_build="/usr", libdir="$prefix/lib", includedir="$prefix/include". - -If this gets installed with make DESTDIR="/foo" install, then we end up with -prefix_real = prefix = "/foo/usr" as expected, but -includedir="/foo/foo/usr/include" and libdir="/foo/foo/usr/lib" because of -the double sed invocation (prefix is already expanded). Work around it by -ensuring we only match the beginning of the string. - -Submitted upstream: http://bugs.python.org/issue22907 - -Signed-off-by: Peter Korsgaard ---- - Misc/python-config.sh.in | 13 +++++++------ - 1 file changed, 7 insertions(+), 6 deletions(-) - -diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in -index 2602fe24c0..a1bc3cd5f7 100644 ---- a/Misc/python-config.sh.in -+++ b/Misc/python-config.sh.in -@@ -24,18 +24,19 @@ installed_prefix () - echo $RESULT - } - -+prefix_build="@prefix@" - prefix_real=$(installed_prefix "$0") - - # Use sed to fix paths from their built-to locations to their installed-to - # locations. Keep prefix & exec_prefix using their original values in case - # they are referenced in other configure variables, to prevent double - # substitution, issue #22140. --prefix="@prefix@" --exec_prefix="@exec_prefix@" -+prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#") -+exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#") - exec_prefix_real=${prefix_real} --includedir=$(echo "@includedir@" | sed "s#$prefix#$prefix_real#") --libdir=$(echo "@libdir@" | sed "s#$prefix#$prefix_real#") --CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix#$prefix_real#") -+includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#") -+libdir=$(echo "@libdir@" | sed "s#^$prefix_build#$prefix_real#") -+CFLAGS=$(echo "@CFLAGS@" | sed "s#^$prefix_build#$prefix_real#") - VERSION="@VERSION@" - LIBM="@LIBM@" - LIBC="@LIBC@" -@@ -49,7 +50,7 @@ OPT="@OPT@" - PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" - LDVERSION="@LDVERSION@" - LIBDEST=${prefix_real}/lib/python${VERSION} --LIBPL=$(echo "@LIBPL@" | sed "s#$prefix#$prefix_real#") -+LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#") - SO="@EXT_SUFFIX@" - PYTHONFRAMEWORK="@PYTHONFRAMEWORK@" - INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}" --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0011-Add-an-option-to-disable-pydoc.patch b/packages/lang/Python3/patches/0011-Add-an-option-to-disable-pydoc.patch deleted file mode 100644 index f7bfd437bb..0000000000 --- a/packages/lang/Python3/patches/0011-Add-an-option-to-disable-pydoc.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 38b7f7949258aeadf8bc45525be91340bb732a2a Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 22 Feb 2017 17:07:56 -0800 -Subject: [PATCH] Add an option to disable pydoc - -It removes 0.5 MB of data from the target plus the pydoc script -itself. - -Signed-off-by: Thomas Petazzoni -Signed-off-by: Samuel Martin -[ Andrey Smirnov: ported to Python 3.6 ] -Signed-off-by: Andrey Smirnov -[ Adam Duskett: ported to Python 3.10.0 ] -Signed-off-by: Adam Duskett ---- - Makefile.pre.in | 7 ++++++- - configure.ac | 6 ++++++ - setup.py | 9 +++++++-- - 3 files changed, 19 insertions(+), 3 deletions(-) - -diff --git a/Makefile.pre.in b/Makefile.pre.in -index c1cfb96767..403380e181 100644 ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -1864,7 +1864,9 @@ bininstall: altbininstall - -rm -f $(DESTDIR)$(BINDIR)/idle3 - (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3) - -rm -f $(DESTDIR)$(BINDIR)/pydoc3 -+ifeq (@PYDOC@,yes) - (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) -+endif - -rm -f $(DESTDIR)$(BINDIR)/2to3 - (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3) - if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ -@@ -1915,7 +1917,6 @@ LIBSUBDIRS= asyncio \ - lib2to3 lib2to3/fixes lib2to3/pgen2 \ - logging \ - multiprocessing multiprocessing/dummy \ -- pydoc_data \ - re \ - site-packages \ - sqlite3 \ -@@ -2008,6 +2009,10 @@ TESTSUBDIRS= ctypes/test \ - tkinter/test/test_ttk \ - unittest/test unittest/test/testmock - -+ifeq (@PYDOC@,yes) -+LIBSUBDIRS += pydoc_data -+endif -+ - TEST_MODULES=@TEST_MODULES@ - libinstall: all $(srcdir)/Modules/xxmodule.c - @for i in $(SCRIPTDIR) $(LIBDEST); \ -diff --git a/configure.ac b/configure.ac -index 5a6a1fe608..f68ea72321 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4171,6 +4171,12 @@ AS_VAR_IF([posix_threads], [stub], [ - AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support]) - ]) - -+AC_SUBST(PYDOC) -+ -+AC_ARG_ENABLE(pydoc, -+ AS_HELP_STRING([--disable-pydoc], [disable pydoc]), -+ [ PYDOC="${enableval}" ], [ PYDOC=yes ]) -+ - # Check for enable-ipv6 - AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) - AC_MSG_CHECKING([if --enable-ipv6 is specified]) -diff --git a/setup.py b/setup.py -index 0e04944ce0..3e55f5b2e0 100644 ---- a/setup.py -+++ b/setup.py -@@ -1593,6 +1593,12 @@ class DummyProcess: - # turn off warnings when deprecated modules are imported - import warnings - warnings.filterwarnings("ignore",category=DeprecationWarning) -+ -+ scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3', -+ 'Lib/smtpd.py'] -+ if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): -+ scripts += [ 'Tools/scripts/pydoc3' ] -+ - setup(# PyPI Metadata (PEP 301) - name = "Python", - version = sys.version.split()[0], -@@ -1617,8 +1623,7 @@ class DummyProcess: - # If you change the scripts installed here, you also need to - # check the PyBuildScripts command above, and change the links - # created by the bininstall target in Makefile.pre.in -- scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3", -- "Tools/scripts/2to3"] -+ scripts = scripts - ) - - # --install-platlib --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0029-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch b/packages/lang/Python3/patches/0011-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch similarity index 88% rename from packages/lang/Python3/patches/0029-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch rename to packages/lang/Python3/patches/0011-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch index 5253076d90..a92f78fe57 100644 --- a/packages/lang/Python3/patches/0029-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch +++ b/packages/lang/Python3/patches/0011-configure.ac-fixup-CC-print-multiarch-output-for-mus.patch @@ -1,4 +1,4 @@ -From 07b950aadd570b9f96a1f128505a959b32f40962 Mon Sep 17 00:00:00 2001 +From 3eccbd53df3c51c1c6ece217d19f1d01eb9575a7 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Fri, 2 Aug 2019 15:53:16 +0200 Subject: [PATCH] configure.ac: fixup $CC --print-multiarch output for @@ -25,15 +25,17 @@ to keep the configure script happy. Signed-off-by: Peter Korsgaard [Peter: updated for 3.10.2] +Signed-off-by: Vincent Fazio +[Vincent: fixup offsets for 3.12.4] --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac -index ed03b27fb1..841fd6732c 100644 +index 1cb95f41fd..d142af404a 100644 --- a/configure.ac +++ b/configure.ac -@@ -1086,7 +1086,11 @@ AC_MSG_CHECKING([for multiarch]) +@@ -1128,7 +1128,11 @@ AC_MSG_CHECKING([for multiarch]) AS_CASE([$ac_sys_system], [Darwin*], [MULTIARCH=""], [FreeBSD*], [MULTIARCH=""], diff --git a/packages/lang/Python3/patches/0012-gh-115382-Fix-cross-compiles-when-host-and-target-us.patch b/packages/lang/Python3/patches/0012-gh-115382-Fix-cross-compiles-when-host-and-target-us.patch new file mode 100644 index 0000000000..5a7949b2fd --- /dev/null +++ b/packages/lang/Python3/patches/0012-gh-115382-Fix-cross-compiles-when-host-and-target-us.patch @@ -0,0 +1,140 @@ +From e7fa6023be567251b409527bd005b93335914501 Mon Sep 17 00:00:00 2001 +From: Vincent Fazio <5265893+vfazio@users.noreply.github.com> +Date: Wed, 28 Feb 2024 13:55:04 -0600 +Subject: [PATCH] gh-115382: Fix cross compiles when host and target use same + SOABI + +Previously, when a build was configured to use a host interpreter via +--with-build-python, the PYTHON_FOR_BUILD config value included a path +in PYTHONPATH that pointed to the target's built external modules. + +For "normal" foreign architecture cross compiles, when loading compiled +external libraries, the target libraries were processed first due to +their precedence in sys.path. These libraries were then ruled out due to +a mismatch in the SOABI so the import mechanism continued searching +until it found the host's native modules. + +However, if the host interpreter and the target python were on the same +version + SOABI combination, the host interpreter would attempt to load +the target's external modules due to their precedence in sys.path. + +Despite the "match", the target build may have been linked against a +different libc or may include unsupported instructions so loading or +executing the target's external modules can lead to crashes. + +Now, the path to the target's external modules is no longer defined in +PYTHONPATH to prevent accidentally loading these foreign modules. + +One caveat is that during certain build stages, the target's sysconfig +module requires higher precedence than the host's version in order to +accurately query the target build's configuration. + +This worked previously due to the target's sysconfig data module having +precedence over the host's (see above). In order to keep this desired +behavior, a new environment variable, _PYTHON_SYSCONFIGDATA_PATH, has +been defined so sysconfig can search this directory for the target's +sysconfig data. + +Signed-off-by: Vincent Fazio +Upstream-issue: https://github.com/python/cpython/issues/115382 +Upstream: https://github.com/python/cpython/pull/116294 +--- + Lib/sysconfig.py | 15 ++++++++++++++- + Lib/test/libregrtest/main.py | 1 + + Lib/test/pythoninfo.py | 1 + + Tools/scripts/run_tests.py | 1 + + configure | 2 +- + configure.ac | 2 +- + 6 files changed, 19 insertions(+), 3 deletions(-) + +diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py +index 122d441bd1..260aec3127 100644 +--- a/Lib/sysconfig.py ++++ b/Lib/sysconfig.py +@@ -533,7 +533,20 @@ def _init_posix(vars): + """Initialize the module as appropriate for POSIX systems.""" + # _sysconfigdata is generated at build time, see _generate_posix_vars() + name = _get_sysconfigdata_name() +- _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) ++ ++ # For cross builds, the path to the target's sysconfigdata must be specified ++ # so it can be imported. It cannot be in PYTHONPATH, as foreign modules in ++ # sys.path can cause crashes when loaded by the host interpreter. ++ # Rely on truthiness as a valueless env variable is still an empty string. ++ # See OS X note in _generate_posix_vars re _sysconfigdata. ++ if (path := os.environ.get('_PYTHON_SYSCONFIGDATA_PATH')): ++ from importlib.machinery import FileFinder, SourceFileLoader, SOURCE_SUFFIXES ++ from importlib.util import module_from_spec ++ spec = FileFinder(path, (SourceFileLoader, SOURCE_SUFFIXES)).find_spec(name) ++ _temp = module_from_spec(spec) ++ spec.loader.exec_module(_temp) ++ else: ++ _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) + build_time_vars = _temp.build_time_vars + vars.update(build_time_vars) + +diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py +index e41646d2d1..f54e570728 100644 +--- a/Lib/test/libregrtest/main.py ++++ b/Lib/test/libregrtest/main.py +@@ -576,6 +576,7 @@ def _add_cross_compile_opts(self, regrtest_opts): + '_PYTHON_PROJECT_BASE', + '_PYTHON_HOST_PLATFORM', + '_PYTHON_SYSCONFIGDATA_NAME', ++ "_PYTHON_SYSCONFIGDATA_PATH", + 'PYTHONPATH' + } + old_environ = os.environ +diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py +index 6efeaad812..d43e52c9e4 100644 +--- a/Lib/test/pythoninfo.py ++++ b/Lib/test/pythoninfo.py +@@ -326,6 +326,7 @@ def format_groups(groups): + "_PYTHON_HOST_PLATFORM", + "_PYTHON_PROJECT_BASE", + "_PYTHON_SYSCONFIGDATA_NAME", ++ "_PYTHON_SYSCONFIGDATA_PATH", + "__PYVENV_LAUNCHER__", + + # Sanitizer options +diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py +index 445a34ae3e..4077a83424 100644 +--- a/Tools/scripts/run_tests.py ++++ b/Tools/scripts/run_tests.py +@@ -42,6 +42,7 @@ def main(regrtest_args): + '_PYTHON_PROJECT_BASE', + '_PYTHON_HOST_PLATFORM', + '_PYTHON_SYSCONFIGDATA_NAME', ++ "_PYTHON_SYSCONFIGDATA_PATH", + 'PYTHONPATH' + } + environ = { +diff --git a/configure b/configure +index 6dc8a66e48..a69346db8c 100755 +--- a/configure ++++ b/configure +@@ -3689,7 +3689,7 @@ fi + fi + ac_cv_prog_PYTHON_FOR_REGEN=$with_build_python + PYTHON_FOR_FREEZE="$with_build_python" +- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$with_build_python ++ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) _PYTHON_SYSCONFIGDATA_PATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`) '$with_build_python + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_build_python" >&5 + printf "%s\n" "$with_build_python" >&6; } + +diff --git a/configure.ac b/configure.ac +index 1cb95f41fd..de420dde2c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -169,7 +169,7 @@ AC_ARG_WITH([build-python], + dnl Build Python interpreter is used for regeneration and freezing. + ac_cv_prog_PYTHON_FOR_REGEN=$with_build_python + PYTHON_FOR_FREEZE="$with_build_python" +- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$with_build_python ++ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) _PYTHON_SYSCONFIGDATA_PATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`) '$with_build_python + AC_MSG_RESULT([$with_build_python]) + ], [ + AS_VAR_IF([cross_compiling], [yes], +-- +2.34.1 + diff --git a/packages/lang/Python3/patches/0014-Add-an-option-to-disable-the-tk-module.patch b/packages/lang/Python3/patches/0014-Add-an-option-to-disable-the-tk-module.patch deleted file mode 100644 index 41184bd869..0000000000 --- a/packages/lang/Python3/patches/0014-Add-an-option-to-disable-the-tk-module.patch +++ /dev/null @@ -1,75 +0,0 @@ -From bbbfe699d648a5cb191203b16e1786e8cf4ea908 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 22 Feb 2017 17:23:42 -0800 -Subject: [PATCH] Add an option to disable the tk module - -Signed-off-by: Thomas Petazzoni -Signed-off-by: Samuel Martin -[ Andrey Smirnov: ported to Python 3.6 ] -Signed-off-by: Andrey Smirnov -[ Adam Duskett: ported to Python 3.10.0 ] -Signed-off-by: Adam Duskett ---- - Makefile.pre.in | 10 +++++++--- - configure.ac | 9 +++++++++ - 2 files changed, 16 insertions(+), 3 deletions(-) - -diff --git a/Makefile.pre.in b/Makefile.pre.in -index 9f4cdf14cf..4f83911200 100644 ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -1920,7 +1920,6 @@ LIBSUBDIRS= asyncio \ - multiprocessing multiprocessing/dummy \ - re \ - site-packages \ -- tkinter \ - tomllib \ - turtledemo \ - unittest \ -@@ -2001,9 +2000,6 @@ TESTSUBDIRS= ctypes/test \ - test/xmltestdata \ - test/xmltestdata/c14n-20 \ - test/ziptestdata \ -- tkinter/test \ -- tkinter/test/test_tkinter \ -- tkinter/test/test_ttk \ - unittest/test \ - unittest/test/testmock - -@@ -2021,6 +2018,13 @@ ifeq (@SQLITE3@,yes) - LIBSUBDIRS += sqlite3 - endif - -+ifeq (@TK@,yes) -+LIBSUBDIRS += tkinter -+TESTSUBDIRS += tkinter/test tkinter/test/test_tkinter \ -+ tkinter/test/test_ttk -+endif -+ -+ - TEST_MODULES=@TEST_MODULES@ - libinstall: all $(srcdir)/Modules/xxmodule.c - @for i in $(SCRIPTDIR) $(LIBDEST); \ -diff --git a/configure.ac b/configure.ac -index 4cc0951ab9..f4ce506801 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4180,6 +4180,15 @@ if test "$SQLITE3" = "no" ; then - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3" - fi - -+AC_SUBST(TK) -+AC_ARG_ENABLE(tk, -+ AS_HELP_STRING([--disable-tk], [disable tk]), -+ [ TK="${enableval}" ], [ TK=yes ]) -+ -+if test "$TK" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _tkinter" -+fi -+ - AC_SUBST(PYDOC) - - AC_ARG_ENABLE(pydoc, --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0017-Add-an-option-to-disable-CJK-codecs.patch b/packages/lang/Python3/patches/0017-Add-an-option-to-disable-CJK-codecs.patch deleted file mode 100644 index 63a07fb514..0000000000 --- a/packages/lang/Python3/patches/0017-Add-an-option-to-disable-CJK-codecs.patch +++ /dev/null @@ -1,30 +0,0 @@ -From d8ef6a7a9f2b954cf1c1e37fc3c35055b42af0f5 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 23 Dec 2015 11:49:55 +0100 -Subject: [PATCH] Add an option to disable CJK codecs - -Signed-off-by: Thomas Petazzoni ---- - configure.ac | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 201cad0bfc..ecdd7dbc07 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4188,6 +4188,12 @@ if test "$SQLITE3" = "no" ; then - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _sqlite3" - fi - -+AC_ARG_ENABLE(codecs-cjk, -+ AS_HELP_STRING([--disable-codecs-cjk], [disable CJK codecs]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022" -+ fi]) -+ - AC_SUBST(TK) - AC_ARG_ENABLE(tk, - AS_HELP_STRING([--disable-tk], [disable tk]), --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0018-Add-an-option-to-disable-NIS.patch b/packages/lang/Python3/patches/0018-Add-an-option-to-disable-NIS.patch deleted file mode 100644 index 977955d1cb..0000000000 --- a/packages/lang/Python3/patches/0018-Add-an-option-to-disable-NIS.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 09fc9f72ebe60bb65e80732a6bd4f12a84159f6d Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 23 Dec 2015 11:50:11 +0100 -Subject: [PATCH] Add an option to disable NIS - -NIS is not necessarily available in uClibc, so we need an option to -not compile support for it. - -Signed-off-by: Thomas Petazzoni ---- - configure.ac | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/configure.ac b/configure.ac -index ecdd7dbc07..1bdde7f69d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4194,6 +4194,12 @@ AC_ARG_ENABLE(codecs-cjk, - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _codecs_kr _codecs_jp _codecs_cn _codecs_tw _codecs_hk _codecs_iso2022" - fi]) - -+AC_ARG_ENABLE(nis, -+ AS_HELP_STRING([--disable-nis], [disable NIS]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis" -+ fi]) -+ - AC_SUBST(TK) - AC_ARG_ENABLE(tk, - AS_HELP_STRING([--disable-tk], [disable tk]), --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0019-Add-an-option-to-disable-unicodedata.patch b/packages/lang/Python3/patches/0019-Add-an-option-to-disable-unicodedata.patch deleted file mode 100644 index 74702b67a5..0000000000 --- a/packages/lang/Python3/patches/0019-Add-an-option-to-disable-unicodedata.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 4fe7f375a3d171d294caebdd7b7ce49bbc9ad9f3 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 23 Dec 2015 11:50:27 +0100 -Subject: [PATCH] Add an option to disable unicodedata - -Signed-off-by: Thomas Petazzoni ---- - configure.ac | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 1bdde7f69d..ba4b0e0c1c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4200,6 +4200,12 @@ AC_ARG_ENABLE(nis, - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} nis" - fi]) - -+AC_ARG_ENABLE(unicodedata, -+ AS_HELP_STRING([--disable-unicodedata], [disable unicodedata]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata" -+ fi]) -+ - AC_SUBST(TK) - AC_ARG_ENABLE(tk, - AS_HELP_STRING([--disable-tk], [disable tk]), --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0021-Add-an-option-to-disable-decimal.patch b/packages/lang/Python3/patches/0021-Add-an-option-to-disable-decimal.patch deleted file mode 100644 index d683565f94..0000000000 --- a/packages/lang/Python3/patches/0021-Add-an-option-to-disable-decimal.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 7091fdf77f612425c178a75148560f9c3514e8b8 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 23 Dec 2015 11:51:31 +0100 -Subject: [PATCH] Add an option to disable decimal - -This patch replaces the existing --with-system-libmpdec option with a ---with-libmpdec={system,builtin,none} option, which allows to tell -Python whether we want to use the system libmpdec (already installed), -the libmpdec builtin the Python sources, or no libmpdec at all. - -Signed-off-by: Thomas Petazzoni -[aduskett@gmail.com: Update for python 3.7.0] -Signed-off-by: Adam Duskett -[james.hilliard1@gmail.com: adapt to python 3.9] -Signed-off-by: James Hilliard ---- - configure.ac | 19 +++++++++++++------ - 1 file changed, 13 insertions(+), 6 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 5e6d72f7db..e6b1f1e9de 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -3630,14 +3630,21 @@ fi - AC_SUBST(LIBFFI_INCLUDEDIR) - - # Check for use of the system libmpdec library --AC_MSG_CHECKING(for --with-system-libmpdec) --AC_ARG_WITH(system_libmpdec, -- AS_HELP_STRING([--with-system-libmpdec], [build _decimal module using an installed libmpdec library, see Doc/library/decimal.rst (default is no)]), -+AC_MSG_CHECKING(for --with-libmpdec) -+AC_ARG_WITH(libmpdec, -+ AS_HELP_STRING([--with-libmpdec], [select which libmpdec version to use: system, builtin, none]), - [], -- [with_system_libmpdec="no"]) --AC_MSG_RESULT($with_system_libmpdec) -+ [with_libmpdec="builtin"]) -+AC_MSG_RESULT($with_libmpdec) -+if test "$with_libmpdec" != "none"; then -+ MPDEC=yes -+else -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _decimal" -+ MPDEC=no -+fi -+AC_SUBST(MPDEC) - --AS_VAR_IF([with_system_libmpdec], [yes], [ -+AS_VAR_IF([with_libmpdec], [system], [ - LIBMPDEC_CFLAGS=${LIBMPDEC_CFLAGS-""} - LIBMPDEC_LDFLAGS=${LIBMPDEC_LDFLAGS-"-lmpdec"} - LIBMPDEC_INTERNAL= --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0022-Add-an-option-to-disable-the-ossaudiodev-module.patch b/packages/lang/Python3/patches/0022-Add-an-option-to-disable-the-ossaudiodev-module.patch deleted file mode 100644 index 56713a7f8f..0000000000 --- a/packages/lang/Python3/patches/0022-Add-an-option-to-disable-the-ossaudiodev-module.patch +++ /dev/null @@ -1,30 +0,0 @@ -From d48d9da534cec7891ae444b4ab94a76ac67f5daa Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Wed, 23 Dec 2015 11:51:58 +0100 -Subject: [PATCH] Add an option to disable the ossaudiodev module - -Signed-off-by: Thomas Petazzoni ---- - configure.ac | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/configure.ac b/configure.ac -index e6b1f1e9de..db33d567ad 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -3678,6 +3678,12 @@ fi - - AC_MSG_RESULT($with_decimal_contextvar) - -+AC_ARG_ENABLE(ossaudiodev, -+ AS_HELP_STRING([--disable-ossaudiodev], [disable OSSAUDIODEV]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ossaudiodev" -+ fi]) -+ - # Check for libmpdec machine flavor - AC_MSG_CHECKING(for decimal libmpdec machine) - AS_CASE([$ac_sys_system], --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0023-Add-an-option-to-disable-openssl-support.patch b/packages/lang/Python3/patches/0023-Add-an-option-to-disable-openssl-support.patch deleted file mode 100644 index d4c9fd43be..0000000000 --- a/packages/lang/Python3/patches/0023-Add-an-option-to-disable-openssl-support.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 25c900e81a2fc0bbe35e7c94e2e5028cfbf6582a Mon Sep 17 00:00:00 2001 -From: Nicolas Cavallari -Date: Wed, 22 Feb 2017 17:55:59 -0800 -Subject: [PATCH] Add an option to disable openssl support. - -Signed-off-by: Nicolas Cavallari ---- - configure.ac | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/configure.ac b/configure.ac -index db33d567ad..42fe6c8f5a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4219,6 +4219,12 @@ AC_ARG_ENABLE(unicodedata, - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} unicodedata" - fi]) - -+AC_ARG_ENABLE(openssl, -+ AS_HELP_STRING([--disable-openssl], [disable openssl support]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib" -+ fi]) -+ - AC_SUBST(TK) - AC_ARG_ENABLE(tk, - AS_HELP_STRING([--disable-tk], [disable tk]), --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0024-Add-an-option-to-disable-the-readline-module.patch b/packages/lang/Python3/patches/0024-Add-an-option-to-disable-the-readline-module.patch deleted file mode 100644 index 9250007dae..0000000000 --- a/packages/lang/Python3/patches/0024-Add-an-option-to-disable-the-readline-module.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 9082468ca620db77b670ccf568a96bbabb865f80 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Tue, 7 Mar 2017 23:29:05 +0100 -Subject: [PATCH] Add an option to disable the readline module - -Signed-off-by: Thomas Petazzoni ---- - configure.ac | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 42fe6c8f5a..19875d7d30 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4225,6 +4225,12 @@ AC_ARG_ENABLE(openssl, - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} ssl _ssl _hashlib" - fi]) - -+AC_ARG_ENABLE(readline, -+ AS_HELP_STRING([--disable-readline], [disable readline]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline" -+ fi]) -+ - AC_SUBST(TK) - AC_ARG_ENABLE(tk, - AS_HELP_STRING([--disable-tk], [disable tk]), --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0025-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch b/packages/lang/Python3/patches/0025-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch deleted file mode 100644 index 70a0d6cd15..0000000000 --- a/packages/lang/Python3/patches/0025-Add-options-to-disable-zlib-bzip2-and-xz-modules.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 988a335cb34b5fc25ea345ba04ff5ddffe2e946c Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Tue, 7 Mar 2017 23:31:11 +0100 -Subject: [PATCH] Add options to disable zlib, bzip2 and xz modules - -Signed-off-by: Thomas Petazzoni ---- - configure.ac | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 19875d7d30..ca6c16491a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4231,6 +4231,24 @@ AC_ARG_ENABLE(readline, - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} readline" - fi]) - -+AC_ARG_ENABLE(bzip2, -+ AS_HELP_STRING([--disable-bzip2], [disable bzip2]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _bz2" -+ fi]) -+ -+AC_ARG_ENABLE(zlib, -+ AS_HELP_STRING([--disable-zlib], [disable zlib]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} zlib" -+ fi]) -+ -+AC_ARG_ENABLE(xz, -+ AS_HELP_STRING([--disable-xz], [disable xz]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _lzma" -+ fi]) -+ - AC_SUBST(TK) - AC_ARG_ENABLE(tk, - AS_HELP_STRING([--disable-tk], [disable tk]), --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0026-python-config.sh-don-t-reassign-prefix.patch b/packages/lang/Python3/patches/0026-python-config.sh-don-t-reassign-prefix.patch deleted file mode 100644 index b6bfb010a0..0000000000 --- a/packages/lang/Python3/patches/0026-python-config.sh-don-t-reassign-prefix.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 755fb526a62df2a73560f42184db8aadb6899bb0 Mon Sep 17 00:00:00 2001 -From: Matt Weber -Date: Fri, 6 Oct 2017 09:54:15 -0500 -Subject: [PATCH] python-config.sh: don't reassign ${prefix} - -When prefix is set to a path like /usr during crossbuild -the sed operations end up executing twice, once for the prefix -reassignment and another for includedir if it is set as a string -including the ${prefix} variable. This results in an issue -when the build directory is under /usr. - -This patch updates the remaining location which uses the prefix -variable to also sed and update to use the real path. - -Upstream bug report: -https://bugs.python.org/issue31713 - -Buildroot bug: -https://bugs.busybox.net/show_bug.cgi?id=10361 - -Fixes failures like the following: -dbus-python-1.2.4 | NOK | http://autobuild.buildroot.net/results/758858efa97b6273c1b470513f5492258a6d8853 - -Signed-off-by: Matthew Weber ---- - Misc/python-config.sh.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in -index a1bc3cd5f7..164d2d3603 100644 ---- a/Misc/python-config.sh.in -+++ b/Misc/python-config.sh.in -@@ -31,7 +31,7 @@ prefix_real=$(installed_prefix "$0") - # locations. Keep prefix & exec_prefix using their original values in case - # they are referenced in other configure variables, to prevent double - # substitution, issue #22140. --prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#") -+prefix=$prefix_build - exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#") - exec_prefix_real=${prefix_real} - includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#") -@@ -49,7 +49,7 @@ LDLIBRARY="@LDLIBRARY@" - OPT="@OPT@" - PY_ENABLE_SHARED="@PY_ENABLE_SHARED@" - LDVERSION="@LDVERSION@" --LIBDEST=${prefix_real}/lib/python${VERSION} -+LIBDEST=$( echo "${prefix}/lib/python${VERSION}" | sed "s#^$prefix_build#$prefix_real#") - LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#") - SO="@EXT_SUFFIX@" - PYTHONFRAMEWORK="@PYTHONFRAMEWORK@" --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0027-Add-an-option-to-disable-uuid-module.patch b/packages/lang/Python3/patches/0027-Add-an-option-to-disable-uuid-module.patch deleted file mode 100644 index a9501ec189..0000000000 --- a/packages/lang/Python3/patches/0027-Add-an-option-to-disable-uuid-module.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 58027d25c3cabcf654cb0b31a61d7cbd53dc68c0 Mon Sep 17 00:00:00 2001 -From: Thomas Petazzoni -Date: Sat, 18 Aug 2018 10:54:56 +0200 -Subject: [PATCH] Add an option to disable uuid module - -Signed-off-by: Thomas Petazzoni ---- - configure.ac | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/configure.ac b/configure.ac -index ca6c16491a..ed03b27fb1 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4267,6 +4267,15 @@ if test "$CURSES" = "no"; then - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _curses _curses_panel" - fi - -+AC_SUBST(UUID) -+AC_ARG_ENABLE(uuid, -+ AS_HELP_STRING([--disable-uuid], [disable uuid]), -+ [ UUID="${enableval}" ], [ UUID=yes ]) -+ -+if test "$UUID" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _uuid" -+fi -+ - AC_SUBST(PYDOC) - - AC_ARG_ENABLE(pydoc, --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0030-Add-an-option-to-disable-the-berkeleydb-module.patch b/packages/lang/Python3/patches/0030-Add-an-option-to-disable-the-berkeleydb-module.patch deleted file mode 100644 index 5fb436db59..0000000000 --- a/packages/lang/Python3/patches/0030-Add-an-option-to-disable-the-berkeleydb-module.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 67e9793d070ac5c8e83abbe95b9208533ffeadd0 Mon Sep 17 00:00:00 2001 -From: Bernd Kuhls -Date: Sat, 11 Apr 2020 22:01:40 +0200 -Subject: [PATCH] Add an option to disable the berkeleydb module - -Signed-off-by: Bernd Kuhls ---- - configure.ac | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 841fd6732c..06c9a81f95 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -4280,6 +4280,12 @@ if test "$UUID" = "no"; then - DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _uuid" - fi - -+AC_ARG_ENABLE(berkeleydb, -+ AS_HELP_STRING([--disable-berkeleydb], [disable berkeleydb]), -+ [ if test "$enableval" = "no"; then -+ DISABLED_EXTENSIONS="${DISABLED_EXTENSIONS} _dbm" -+ fi]) -+ - AC_SUBST(PYDOC) - - AC_ARG_ENABLE(pydoc, --- -2.34.1 - diff --git a/packages/lang/Python3/patches/0031-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch b/packages/lang/Python3/patches/0031-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch deleted file mode 100644 index 712fd08fb1..0000000000 --- a/packages/lang/Python3/patches/0031-lib-crypt-uClibc-ng-doesn-t-set-errno-when-encryptio.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 3edeed879871a10acbe802f4a68cff3d4869dbde Mon Sep 17 00:00:00 2001 -From: Romain Naour -Date: Thu, 12 Nov 2020 00:16:18 +0100 -Subject: [PATCH] lib/crypt: uClibc-ng doesn't set errno when encryption method - is not available - -Since commit [1] in cpython, an exception is raised when an encryption method -is not available. This eception is handled only if errno is set to EINVAL by -crypt() but uClibc-ng doesn't set errno in crypt() [2]. - -Fixes: -https://gitlab.com/buildroot.org/buildroot/-/jobs/830981961 -https://gitlab.com/buildroot.org/buildroot/-/jobs/830981979 - -[1] https://github.com/python/cpython/commit/0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c -[2] https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libcrypt/crypt.c?h=v1.0.36#n29 - -Signed-off-by: Romain Naour -[Daniel: updated for 3.10.7] -Signed-off-by: Daniel Lang ---- - Lib/crypt.py | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/Lib/crypt.py b/Lib/crypt.py -index de4a14a388..ba482487a7 100644 ---- a/Lib/crypt.py -+++ b/Lib/crypt.py -@@ -98,7 +98,9 @@ def _add_method(name, *args, rounds=None): - result = crypt('', salt) - except OSError as e: - # Not all libc libraries support all encryption methods. -- if e.errno in {errno.EINVAL, errno.EPERM, errno.ENOSYS}: -+ # Not all libc libraries set errno when encryption method is not -+ # available. -+ if e.errno in {errno.EINVAL, errno.EPERM, errno.ENOSYS} or e.errno == 0: - return False - raise - if result and len(result) == method.total_size: --- -2.34.1 - diff --git a/packages/lang/Python3/patches/Python3-0201-xcompile.patch b/packages/lang/Python3/patches/Python3-0201-xcompile.patch deleted file mode 100644 index 5e51cdc752..0000000000 --- a/packages/lang/Python3/patches/Python3-0201-xcompile.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -633,9 +633,11 @@ sharedmods: $(BUILDPYTHON) pybuilddir.tx - *) quiet="";; \ - esac; \ - echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \ - DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ -+ PYTHONXCPREFIX='$(DESTDIR)$(prefix)' \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build - - -@@ -1750,8 +1752,10 @@ libainstall: @DEF_MAKE_RULE@ python-conf - # Install the dynamically loadable modules - # This goes into $(exec_prefix) - sharedinstall: all -+ CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \ - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ -+ --skip-build \ - --prefix=$(prefix) \ - --install-scripts=$(BINDIR) \ - --install-platlib=$(DESTSHARED) \ ---- a/setup.py -+++ b/setup.py -@@ -61,7 +61,7 @@ def get_platform(): - return sys.platform - - --CROSS_COMPILING = ("_PYTHON_HOST_PLATFORM" in os.environ) -+CROSS_COMPILING = ("_PYTHON_HOST_PLATFORM" in os.environ) or ('PYTHONXCPREFIX' in os.environ) - HOST_PLATFORM = get_platform() - MS_WINDOWS = (HOST_PLATFORM == 'win32') - CYGWIN = (HOST_PLATFORM == 'cygwin') -@@ -575,6 +575,13 @@ class PyBuildExt(build_ext): - ext.name, level=1) - return - -+ # Import check will not work when cross-compiling. -+ if 'PYTHONXCPREFIX' in os.environ: -+ self.announce( -+ 'WARNING: skipping import check for cross-compiled: "%s"' % -+ ext.name) -+ return -+ - # Workaround for Mac OS X: The Carbon-based modules cannot be - # reliably imported into a command-line Python - if 'Carbon' in ext.extra_link_args: diff --git a/packages/lang/Python3/patches/Python3-0202-xcompile.patch b/packages/lang/Python3/patches/Python3-0202-xcompile.patch deleted file mode 100644 index ec81b41118..0000000000 --- a/packages/lang/Python3/patches/Python3-0202-xcompile.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/setup.py -+++ b/setup.py -@@ -742,31 +742,23 @@ class PyBuildExt(build_ext): - add_dir_to_list(dir_list, directory) - - def configure_compiler(self): -- # Ensure that /usr/local is always used, but the local build -- # 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.include_dirs, '/usr/local/include') -+ try: -+ modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split() -+ except KeyError: -+ modules_include_dirs = ['/usr/include'] -+ try: -+ modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split() -+ except KeyError: -+ modules_lib_dirs = ['/usr/lib'] - self.add_multiarch_paths() -- # only change this for cross builds for 3.3, issues on Mageia -- if CROSS_COMPILING: -- self.add_cross_compiling_paths() -+ for dir in modules_include_dirs: -+ add_dir_to_list(self.compiler.include_dirs, dir) -+ for dir in modules_lib_dirs: -+ add_dir_to_list(self.compiler.library_dirs, dir) -+ - self.add_ldflags_cppflags() - - def init_inc_lib_dirs(self): -- if (not CROSS_COMPILING and -- os.path.normpath(sys.base_prefix) != '/usr' and -- not sysconfig.get_config_var('PYTHONFRAMEWORK')): -- # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework -- # (PYTHONFRAMEWORK is set) to avoid # linking problems when -- # building a framework with different architectures than -- # the one that is currently installed (issue #7473) -- add_dir_to_list(self.compiler.library_dirs, -- sysconfig.get_config_var("LIBDIR")) -- add_dir_to_list(self.compiler.include_dirs, -- sysconfig.get_config_var("INCLUDEDIR")) -- - system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib'] - system_include_dirs = ['/usr/include'] - # lib_dirs and inc_dirs are used to search for files; diff --git a/packages/lang/Python3/patches/Python3-0400-fix-bpo5537.patch b/packages/lang/Python3/patches/Python3-0400-fix-bpo5537.patch deleted file mode 100644 index edb3496a91..0000000000 --- a/packages/lang/Python3/patches/Python3-0400-fix-bpo5537.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 7c35472bc734876f940fdc71090ad3d526e95a82 Mon Sep 17 00:00:00 2001 -From: MilhouseVH -Date: Fri, 14 Feb 2020 01:33:34 +0000 -Subject: [PATCH] Fix issue 5537 - regression on 32-bit - -https://bugs.python.org/issue5537 -https://forum.kodi.tv/showthread.php?tid=343068&pid=2923934#pid2923934 ---- - Lib/http/cookiejar.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/Lib/http/cookiejar.py -+++ b/Lib/http/cookiejar.py -@@ -99,7 +99,7 @@ def time2isoz(t=None): - if t is None: - dt = datetime.datetime.utcnow() - else: -- dt = datetime.datetime.utcfromtimestamp(t) -+ dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=t) - return "%04d-%02d-%02d %02d:%02d:%02dZ" % ( - dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second) - diff --git a/packages/lang/Python3/patches/py312-cpython118618-1.patch b/packages/lang/Python3/patches/py312-cpython118618-1.patch new file mode 100644 index 0000000000..5055a39779 --- /dev/null +++ b/packages/lang/Python3/patches/py312-cpython118618-1.patch @@ -0,0 +1,369 @@ +From 21f8fbaa7c01a8ec2fa2420f44f5cb05a54f55b6 Mon Sep 17 00:00:00 2001 +From: Neil Schemenauer +Date: Wed, 27 Mar 2024 09:54:02 -0700 +Subject: [PATCH] Use pointer for interp->obmalloc state. + +For interpreters that share state with the main interpreter, this points +to the same static memory structure. For interpreters with their own +obmalloc state, it is heap allocated. Add free_obmalloc_arenas() which +will free the obmalloc arenas and radix tree structures for interpreters +with their own obmalloc state. +--- + Include/internal/pycore_interp.h | 12 +- + Include/internal/pycore_obmalloc.h | 2 + + Include/internal/pycore_obmalloc_init.h | 7 - + Include/internal/pycore_runtime_init.h | 1 - + ...-12-22-13-21-39.gh-issue-113055.47xBMF.rst | 5 + + Objects/obmalloc.c | 121 +++++++++++++++++- + Python/pylifecycle.c | 16 +++ + Python/pystate.c | 13 +- + Tools/c-analyzer/cpython/ignored.tsv | 3 +- + 9 files changed, 157 insertions(+), 23 deletions(-) + create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-12-22-13-21-39.gh-issue-113055.47xBMF.rst + +diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h +index 37cc88ed081b72..a0ef5990259e29 100644 +--- a/Include/internal/pycore_interp.h ++++ b/Include/internal/pycore_interp.h +@@ -178,7 +178,17 @@ struct _is { + struct _warnings_runtime_state warnings; + struct atexit_state atexit; + +- struct _obmalloc_state obmalloc; ++ // Per-interpreter state for the obmalloc allocator. For the main ++ // interpreter and for all interpreters that don't have their ++ // own obmalloc state, this points to the static structure in ++ // obmalloc.c obmalloc_state_main. For other interpreters, it is ++ // heap allocated by _PyMem_init_obmalloc() and freed when the ++ // interpreter structure is freed. In the case of a heap allocated ++ // obmalloc state, it is not safe to hold on to or use memory after ++ // the interpreter is freed. The obmalloc state corresponding to ++ // that allocated memory is gone. See free_obmalloc_arenas() for ++ // more comments. ++ struct _obmalloc_state *obmalloc; + + PyObject *audit_hooks; + PyType_WatchCallback type_watchers[TYPE_MAX_WATCHERS]; +diff --git a/Include/internal/pycore_obmalloc.h b/Include/internal/pycore_obmalloc.h +index b1c00654ac1c5d..38427e194956ac 100644 +--- a/Include/internal/pycore_obmalloc.h ++++ b/Include/internal/pycore_obmalloc.h +@@ -686,6 +686,8 @@ extern Py_ssize_t _Py_GetGlobalAllocatedBlocks(void); + _Py_GetGlobalAllocatedBlocks() + extern Py_ssize_t _PyInterpreterState_GetAllocatedBlocks(PyInterpreterState *); + extern void _PyInterpreterState_FinalizeAllocatedBlocks(PyInterpreterState *); ++extern int _PyMem_init_obmalloc(PyInterpreterState *interp); ++extern bool _PyMem_obmalloc_state_on_heap(PyInterpreterState *interp); + + + #ifdef WITH_PYMALLOC +diff --git a/Include/internal/pycore_obmalloc_init.h b/Include/internal/pycore_obmalloc_init.h +index 8ee72ff2d4126f..e6811b7aeca73c 100644 +--- a/Include/internal/pycore_obmalloc_init.h ++++ b/Include/internal/pycore_obmalloc_init.h +@@ -59,13 +59,6 @@ extern "C" { + .dump_debug_stats = -1, \ + } + +-#define _obmalloc_state_INIT(obmalloc) \ +- { \ +- .pools = { \ +- .used = _obmalloc_pools_INIT(obmalloc.pools), \ +- }, \ +- } +- + + #ifdef __cplusplus + } +diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h +index e5f9e17efff24b..d3a64b3d4a7895 100644 +--- a/Include/internal/pycore_runtime_init.h ++++ b/Include/internal/pycore_runtime_init.h +@@ -88,7 +88,6 @@ extern PyTypeObject _PyExc_MemoryError; + { \ + .id_refcount = -1, \ + .imports = IMPORTS_INIT, \ +- .obmalloc = _obmalloc_state_INIT(INTERP.obmalloc), \ + .ceval = { \ + .recursion_limit = Py_DEFAULT_RECURSION_LIMIT, \ + }, \ +diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-12-22-13-21-39.gh-issue-113055.47xBMF.rst b/Misc/NEWS.d/next/Core and Builtins/2023-12-22-13-21-39.gh-issue-113055.47xBMF.rst +new file mode 100644 +index 00000000000000..90f49272218c96 +--- /dev/null ++++ b/Misc/NEWS.d/next/Core and Builtins/2023-12-22-13-21-39.gh-issue-113055.47xBMF.rst +@@ -0,0 +1,5 @@ ++Make interp->obmalloc a pointer. For interpreters that share state with the ++main interpreter, this points to the same static memory structure. For ++interpreters with their own obmalloc state, it is heap allocated. Add ++free_obmalloc_arenas() which will free the obmalloc arenas and radix tree ++structures for interpreters with their own obmalloc state. +diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c +index 9620a8fbb44cac..acbefef614195c 100644 +--- a/Objects/obmalloc.c ++++ b/Objects/obmalloc.c +@@ -3,6 +3,7 @@ + #include "Python.h" + #include "pycore_code.h" // stats + #include "pycore_pystate.h" // _PyInterpreterState_GET ++#include "pycore_obmalloc_init.h" + + #include "pycore_obmalloc.h" + #include "pycore_pymem.h" +@@ -852,6 +853,13 @@ static int running_on_valgrind = -1; + + typedef struct _obmalloc_state OMState; + ++/* obmalloc state for main interpreter and shared by all interpreters without ++ * their own obmalloc state. By not explicitly initalizing this structure, it ++ * will be allocated in the BSS which is a small performance win. The radix ++ * tree arrays are fairly large but are sparsely used. */ ++static struct _obmalloc_state obmalloc_state_main; ++static bool obmalloc_state_initialized; ++ + static inline int + has_own_state(PyInterpreterState *interp) + { +@@ -864,10 +872,8 @@ static inline OMState * + get_state(void) + { + PyInterpreterState *interp = _PyInterpreterState_GET(); +- if (!has_own_state(interp)) { +- interp = _PyInterpreterState_Main(); +- } +- return &interp->obmalloc; ++ assert(interp->obmalloc != NULL); // otherwise not initialized or freed ++ return interp->obmalloc; + } + + // These macros all rely on a local "state" variable. +@@ -893,7 +899,11 @@ _PyInterpreterState_GetAllocatedBlocks(PyInterpreterState *interp) + "the interpreter doesn't have its own allocator"); + } + #endif +- OMState *state = &interp->obmalloc; ++ OMState *state = interp->obmalloc; ++ ++ if (state == NULL) { ++ return 0; ++ } + + Py_ssize_t n = raw_allocated_blocks; + /* add up allocated blocks for used pools */ +@@ -915,13 +925,25 @@ _PyInterpreterState_GetAllocatedBlocks(PyInterpreterState *interp) + return n; + } + ++static void free_obmalloc_arenas(PyInterpreterState *interp); ++ + void + _PyInterpreterState_FinalizeAllocatedBlocks(PyInterpreterState *interp) + { +- if (has_own_state(interp)) { ++ if (has_own_state(interp) && interp->obmalloc != NULL) { + Py_ssize_t leaked = _PyInterpreterState_GetAllocatedBlocks(interp); + assert(has_own_state(interp) || leaked == 0); + interp->runtime->obmalloc.interpreter_leaks += leaked; ++ if (_PyMem_obmalloc_state_on_heap(interp) && leaked == 0) { ++ // free the obmalloc arenas and radix tree nodes. If leaked > 0 ++ // then some of the memory allocated by obmalloc has not been ++ // freed. It might be safe to free the arenas in that case but ++ // it's possible that extension modules are still using that ++ // memory. So, it is safer to not free and to leak. Perhaps there ++ // should be warning when this happens. It should be possible to ++ // use a tool like "-fsanitize=address" to track down these leaks. ++ free_obmalloc_arenas(interp); ++ } + } + } + +@@ -2511,9 +2533,96 @@ _PyDebugAllocatorStats(FILE *out, + (void)printone(out, buf2, num_blocks * sizeof_block); + } + ++// Return true if the obmalloc state structure is heap allocated, ++// by PyMem_RawCalloc(). For the main interpreter, this structure ++// allocated in the BSS. Allocating that way gives some memory savings ++// and a small performance win (at least on a demand paged OS). On ++// 64-bit platforms, the obmalloc structure is 256 kB. Most of that ++// memory is for the arena_map_top array. Since normally only one entry ++// of that array is used, only one page of resident memory is actually ++// used, rather than the full 256 kB. ++bool _PyMem_obmalloc_state_on_heap(PyInterpreterState *interp) ++{ ++#if WITH_PYMALLOC ++ return interp->obmalloc && interp->obmalloc != &obmalloc_state_main; ++#else ++ return false; ++#endif ++} ++ ++#ifdef WITH_PYMALLOC ++static void ++init_obmalloc_pools(PyInterpreterState *interp) ++{ ++ // initialize the obmalloc->pools structure. This must be done ++ // before the obmalloc alloc/free functions can be called. ++ poolp temp[OBMALLOC_USED_POOLS_SIZE] = ++ _obmalloc_pools_INIT(interp->obmalloc->pools); ++ memcpy(&interp->obmalloc->pools.used, temp, sizeof(temp)); ++} ++#endif /* WITH_PYMALLOC */ ++ ++int _PyMem_init_obmalloc(PyInterpreterState *interp) ++{ ++#ifdef WITH_PYMALLOC ++ /* Initialize obmalloc, but only for subinterpreters, ++ since the main interpreter is initialized statically. */ ++ if (_Py_IsMainInterpreter(interp) ++ || _PyInterpreterState_HasFeature(interp, ++ Py_RTFLAGS_USE_MAIN_OBMALLOC)) { ++ interp->obmalloc = &obmalloc_state_main; ++ if (!obmalloc_state_initialized) { ++ init_obmalloc_pools(interp); ++ obmalloc_state_initialized = true; ++ } ++ } else { ++ interp->obmalloc = PyMem_RawCalloc(1, sizeof(struct _obmalloc_state)); ++ if (interp->obmalloc == NULL) { ++ return -1; ++ } ++ init_obmalloc_pools(interp); ++ } ++#endif /* WITH_PYMALLOC */ ++ return 0; // success ++} ++ + + #ifdef WITH_PYMALLOC + ++static void ++free_obmalloc_arenas(PyInterpreterState *interp) ++{ ++ OMState *state = interp->obmalloc; ++ for (uint i = 0; i < maxarenas; ++i) { ++ // free each obmalloc memory arena ++ struct arena_object *ao = &allarenas[i]; ++ _PyObject_Arena.free(_PyObject_Arena.ctx, ++ (void *)ao->address, ARENA_SIZE); ++ } ++ // free the array containing pointers to all arenas ++ PyMem_RawFree(allarenas); ++#if WITH_PYMALLOC_RADIX_TREE ++#ifdef USE_INTERIOR_NODES ++ // Free the middle and bottom nodes of the radix tree. These are allocated ++ // by arena_map_mark_used() but not freed when arenas are freed. ++ for (int i1 = 0; i1 < MAP_TOP_LENGTH; i1++) { ++ arena_map_mid_t *mid = arena_map_root.ptrs[i1]; ++ if (mid == NULL) { ++ continue; ++ } ++ for (int i2 = 0; i2 < MAP_MID_LENGTH; i2++) { ++ arena_map_bot_t *bot = arena_map_root.ptrs[i1]->ptrs[i2]; ++ if (bot == NULL) { ++ continue; ++ } ++ PyMem_RawFree(bot); ++ } ++ PyMem_RawFree(mid); ++ } ++#endif ++#endif ++} ++ + #ifdef Py_DEBUG + /* Is target in the list? The list is traversed via the nextpool pointers. + * The list may be NULL-terminated, or circular. Return 1 if target is in +diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c +index a0130fde15d574..fb833ba61cbd9b 100644 +--- a/Python/pylifecycle.c ++++ b/Python/pylifecycle.c +@@ -28,6 +28,7 @@ + #include "pycore_typeobject.h" // _PyTypes_InitTypes() + #include "pycore_typevarobject.h" // _Py_clear_generic_types() + #include "pycore_unicodeobject.h" // _PyUnicode_InitTypes() ++#include "pycore_obmalloc.h" // _PyMem_init_obmalloc() + #include "opcode.h" + + #include // setlocale() +@@ -636,6 +637,13 @@ pycore_create_interpreter(_PyRuntimeState *runtime, + return status; + } + ++ // initialize the interp->obmalloc state. This must be done after ++ // the settings are loaded (so that feature_flags are set) but before ++ // any calls are made to obmalloc functions. ++ if (_PyMem_init_obmalloc(interp) < 0) { ++ return _PyStatus_NO_MEMORY(); ++ } ++ + /* Auto-thread-state API */ + status = _PyGILState_Init(interp); + if (_PyStatus_EXCEPTION(status)) { +@@ -2051,6 +2059,14 @@ new_interpreter(PyThreadState **tstate_p, const PyInterpreterConfig *config) + return _PyStatus_OK(); + } + ++ // initialize the interp->obmalloc state. This must be done after ++ // the settings are loaded (so that feature_flags are set) but before ++ // any calls are made to obmalloc functions. ++ if (_PyMem_init_obmalloc(interp) < 0) { ++ status = _PyStatus_NO_MEMORY(); ++ goto error; ++ } ++ + PyThreadState *tstate = _PyThreadState_New(interp); + if (tstate == NULL) { + PyInterpreterState_Delete(interp); +diff --git a/Python/pystate.c b/Python/pystate.c +index 1337516aa59cbc..a25c3dcf9d09ea 100644 +--- a/Python/pystate.c ++++ b/Python/pystate.c +@@ -14,6 +14,7 @@ + #include "pycore_pystate.h" + #include "pycore_runtime_init.h" // _PyRuntimeState_INIT + #include "pycore_sysmodule.h" ++#include "pycore_obmalloc.h" // _PyMem_obmalloc_state_on_heap() + + /* -------------------------------------------------------------------------- + CAUTION +@@ -636,6 +637,11 @@ free_interpreter(PyInterpreterState *interp) + // The main interpreter is statically allocated so + // should not be freed. + if (interp != &_PyRuntime._main_interpreter) { ++ if (_PyMem_obmalloc_state_on_heap(interp)) { ++ // interpreter has its own obmalloc state, free it ++ PyMem_RawFree(interp->obmalloc); ++ interp->obmalloc = NULL; ++ } + PyMem_RawFree(interp); + } + } +@@ -679,13 +685,6 @@ init_interpreter(PyInterpreterState *interp, + assert(next != NULL || (interp == runtime->interpreters.main)); + interp->next = next; + +- /* Initialize obmalloc, but only for subinterpreters, +- since the main interpreter is initialized statically. */ +- if (interp != &runtime->_main_interpreter) { +- poolp temp[OBMALLOC_USED_POOLS_SIZE] = \ +- _obmalloc_pools_INIT(interp->obmalloc.pools); +- memcpy(&interp->obmalloc.pools.used, temp, sizeof(temp)); +- } + _PyObject_InitState(interp); + + _PyEval_InitState(interp, pending_lock); +diff --git a/Tools/c-analyzer/cpython/ignored.tsv b/Tools/c-analyzer/cpython/ignored.tsv +index 9f36c47ca7ea03..7bcca27ecc32f6 100644 +--- a/Tools/c-analyzer/cpython/ignored.tsv ++++ b/Tools/c-analyzer/cpython/ignored.tsv +@@ -318,7 +318,8 @@ Objects/obmalloc.c - _PyMem_Debug - + Objects/obmalloc.c - _PyMem_Raw - + Objects/obmalloc.c - _PyObject - + Objects/obmalloc.c - last_final_leaks - +-Objects/obmalloc.c - usedpools - ++Objects/obmalloc.c - obmalloc_state_main - ++Objects/obmalloc.c - obmalloc_state_initialized - + Objects/typeobject.c - name_op - + Objects/typeobject.c - slotdefs - + Objects/unicodeobject.c - stripfuncnames - diff --git a/packages/lang/Python3/patches/py312-cpython118618-2.patch b/packages/lang/Python3/patches/py312-cpython118618-2.patch new file mode 100644 index 0000000000..bbd7a5e0d1 --- /dev/null +++ b/packages/lang/Python3/patches/py312-cpython118618-2.patch @@ -0,0 +1,71 @@ +From a867732a619e1cc02369cf0185b53a484d049369 Mon Sep 17 00:00:00 2001 +From: Neil Schemenauer +Date: Mon, 6 May 2024 10:02:17 -0700 +Subject: [PATCH] Fix merge, move _PyMem_init_obmalloc() calls. + +--- + Python/pylifecycle.c | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c +index fb833ba61cbd9b..31a24d4a65aebf 100644 +--- a/Python/pylifecycle.c ++++ b/Python/pylifecycle.c +@@ -637,13 +637,6 @@ pycore_create_interpreter(_PyRuntimeState *runtime, + return status; + } + +- // initialize the interp->obmalloc state. This must be done after +- // the settings are loaded (so that feature_flags are set) but before +- // any calls are made to obmalloc functions. +- if (_PyMem_init_obmalloc(interp) < 0) { +- return _PyStatus_NO_MEMORY(); +- } +- + /* Auto-thread-state API */ + status = _PyGILState_Init(interp); + if (_PyStatus_EXCEPTION(status)) { +@@ -658,6 +651,13 @@ pycore_create_interpreter(_PyRuntimeState *runtime, + return status; + } + ++ // initialize the interp->obmalloc state. This must be done after ++ // the settings are loaded (so that feature_flags are set) but before ++ // any calls are made to obmalloc functions. ++ if (_PyMem_init_obmalloc(interp) < 0) { ++ return _PyStatus_NO_MEMORY(); ++ } ++ + PyThreadState *tstate = _PyThreadState_New(interp); + if (tstate == NULL) { + return _PyStatus_ERR("can't make first thread"); +@@ -2059,14 +2059,6 @@ new_interpreter(PyThreadState **tstate_p, const PyInterpreterConfig *config) + return _PyStatus_OK(); + } + +- // initialize the interp->obmalloc state. This must be done after +- // the settings are loaded (so that feature_flags are set) but before +- // any calls are made to obmalloc functions. +- if (_PyMem_init_obmalloc(interp) < 0) { +- status = _PyStatus_NO_MEMORY(); +- goto error; +- } +- + PyThreadState *tstate = _PyThreadState_New(interp); + if (tstate == NULL) { + PyInterpreterState_Delete(interp); +@@ -2110,6 +2102,14 @@ new_interpreter(PyThreadState **tstate_p, const PyInterpreterConfig *config) + goto error; + } + ++ // initialize the interp->obmalloc state. This must be done after ++ // the settings are loaded (so that feature_flags are set) but before ++ // any calls are made to obmalloc functions. ++ if (_PyMem_init_obmalloc(interp) < 0) { ++ status = _PyStatus_NO_MEMORY(); ++ goto error; ++ } ++ + status = init_interp_create_gil(tstate, config->gil); + if (_PyStatus_EXCEPTION(status)) { + goto error;