From eef3fd5c7ae61f1e1861848dacf94fec4f3c49d4 Mon Sep 17 00:00:00 2001 From: OscarL Date: Fri, 16 Feb 2024 07:27:27 -0300 Subject: [PATCH] python3.11: update to version 3.11.8. (#10110) --- ....7.patchset => python3.11-3.11.8.patchset} | 153 +++++++++++++----- .../patches/python3.11_x86-3.11.7.patchset | 41 ----- ...3.11.7.recipe => python3.11-3.11.8.recipe} | 134 +++++++++------ 3 files changed, 199 insertions(+), 129 deletions(-) rename dev-lang/python/patches/{python3.11-3.11.7.patchset => python3.11-3.11.8.patchset} (88%) delete mode 100644 dev-lang/python/patches/python3.11_x86-3.11.7.patchset rename dev-lang/python/{python3.11-3.11.7.recipe => python3.11-3.11.8.recipe} (69%) diff --git a/dev-lang/python/patches/python3.11-3.11.7.patchset b/dev-lang/python/patches/python3.11-3.11.8.patchset similarity index 88% rename from dev-lang/python/patches/python3.11-3.11.7.patchset rename to dev-lang/python/patches/python3.11-3.11.8.patchset index 1c8426e93..9afc57d3d 100644 --- a/dev-lang/python/patches/python3.11-3.11.7.patchset +++ b/dev-lang/python/patches/python3.11-3.11.8.patchset @@ -1,4 +1,4 @@ -From 03bcbc8084a4e2eb67a36152bdc4b1fc19cf5336 Mon Sep 17 00:00:00 2001 +From 2f00459cfa8328da1ffc7767a464f91dea7b26f7 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 10 Apr 2014 16:03:33 +0000 Subject: initial Haiku patch @@ -152,10 +152,10 @@ index 0000000..4372ee2 +set -v +eval $PYTHON_FOR_BUILD ../../Tools/scripts/h2py.py -i "'(u_long)'" $HEADERS/posix/netinet/in.h diff --git a/Lib/site.py b/Lib/site.py -index 69670d9..82ca5af 100644 +index 2904e44..8face24 100644 --- a/Lib/site.py +++ b/Lib/site.py -@@ -281,6 +281,14 @@ def _getuserbase(): +@@ -291,6 +291,14 @@ def _getuserbase(): return joinuser("~", "Library", sys._framework, "%d.%d" % sys.version_info[:2]) @@ -170,7 +170,7 @@ index 69670d9..82ca5af 100644 return joinuser("~", ".local") -@@ -361,7 +369,14 @@ def getsitepackages(prefixes=None): +@@ -371,7 +379,14 @@ def getsitepackages(prefixes=None): continue seen.add(prefix) @@ -186,7 +186,7 @@ index 69670d9..82ca5af 100644 libdirs = [sys.platlibdir] if sys.platlibdir != "lib": libdirs.append("lib") -@@ -470,8 +485,16 @@ def enablerlcompleter(): +@@ -480,8 +495,16 @@ def enablerlcompleter(): # each interpreter exit when readline was already configured # through a PYTHONSTARTUP hook, see: # http://bugs.python.org/issue5845#msg198636 @@ -218,7 +218,7 @@ index 5cc3d4b..6f53287 100644 # Somehow /dev/tty appears seekable on some BSDs self.assertEqual(f.seekable(), False) diff --git a/Makefile.pre.in b/Makefile.pre.in -index c61b093..86ec08d 100644 +index 4d1921b..bf222f6 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -146,7 +146,7 @@ BINDIR= @bindir@ @@ -373,14 +373,14 @@ index 42123c9..60de40a 100644 2.42.1 -From ce3528842c00cb3600f145306290c2d36f81ffbf Mon Sep 17 00:00:00 2001 +From 9658e361a9cd24dac0c6ee7fc042c9015c8b8b60 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Sun, 16 Apr 2017 10:05:42 +0200 Subject: fix for negative errnos diff --git a/Lib/subprocess.py b/Lib/subprocess.py -index 6df5dd5..39dde15 100644 +index 3264d9a..829477d 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1938,6 +1938,8 @@ class Popen: @@ -389,14 +389,14 @@ index 6df5dd5..39dde15 100644 errno_num = int(hex_errno, 16) + if sys.platform.startswith('haiku'): + errno_num = -errno_num; - child_exec_never_called = (err_msg == "noexec") - if child_exec_never_called: + if err_msg == "noexec:chdir": err_msg = "" + # The error must be from chdir(cwd). diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c -index 072519c..1023c8a 100644 +index d91bf21..cb6c6a2 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c -@@ -724,6 +724,10 @@ error: +@@ -729,6 +729,10 @@ error: char *cur; _Py_write_noraise(errpipe_write, "OSError:", 8); cur = hex_errno + sizeof(hex_errno); @@ -411,17 +411,26 @@ index 072519c..1023c8a 100644 2.42.1 -From 90213d89824d796d82fc5266f65c79a6787daaef Mon Sep 17 00:00:00 2001 -From: Philippe Houdoin -Date: Wed, 24 May 2017 11:09:43 +0000 +From ca76437963d002d811e83bb43012c0d5a8a665b7 Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Sun, 8 Oct 2023 20:06:31 -0300 Subject: Implement CTypes's find_library for Haiku +This combines: + - the original patch by Philippe Houdoin + - A slight variation of Adrien Destugues' fix for x86_gcc2. diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py -index 0c2510e..2b4f04c 100644 +index c550883..6b23423 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py -@@ -265,6 +265,56 @@ elif os.name == "posix": +@@ -1,4 +1,5 @@ + import os ++import platform + import shutil + import subprocess + import sys +@@ -268,6 +269,60 @@ elif os.name == "posix": def find_library(name, is64 = False): return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name)) @@ -446,6 +455,10 @@ index 0c2510e..2b4f04c 100644 + directory = directory.replace('%A', + os.path.dirname(os.path.abspath(sys.argv[0] or os.getcwd()))) + ++ # Are we on x86 32 bits?: ++ if platform.machine() == 'BePC': ++ directory = os.path.join(directory, "x86") ++ + if not os.path.isdir(directory): + continue + @@ -478,7 +491,7 @@ index 0c2510e..2b4f04c 100644 else: def _findSoname_ldconfig(name): -@@ -367,6 +417,12 @@ def test(): +@@ -370,6 +425,12 @@ def test(): print(f"crypt\t:: {cdll.LoadLibrary(find_library('crypt'))}") print(f"crypto\t:: {find_library('crypto')}") print(f"crypto\t:: {cdll.LoadLibrary(find_library('crypto'))}") @@ -495,14 +508,14 @@ index 0c2510e..2b4f04c 100644 2.42.1 -From 90badefb931e909cb4ec993b9b097badcd66e4be Mon Sep 17 00:00:00 2001 +From 853be77903433468b699b96170140a7f622d4af8 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Mon, 23 Sep 2019 09:14:58 +0200 Subject: webbrowser: Support for default browsers on Haiku diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py -index 44974d4..ce78f41 100755 +index 5d72524..eb0879f 100755 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -549,6 +549,11 @@ def register_standard_browsers(): @@ -521,7 +534,7 @@ index 44974d4..ce78f41 100755 2.42.1 -From 7e0b76caa0d03cc8f8761dd9edddd744dd67e300 Mon Sep 17 00:00:00 2001 +From 98361e94e8a22d4e287ba44834bf2ef8d778fe88 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Fri, 4 Oct 2019 22:02:35 +0200 Subject: since 3.8, don't reinit locks on fork. @@ -544,7 +557,7 @@ index bcee2ba..46630a4 100644 2.42.1 -From 8a3b2053eff0af149b8118045a1e5263479557b6 Mon Sep 17 00:00:00 2001 +From 2b6afd77361526bcfbd9d981950e29b7906cc8fb Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Fri, 15 May 2020 15:20:57 +0200 Subject: handle errors returned by internal_connect() @@ -552,7 +565,7 @@ Subject: handle errors returned by internal_connect() upstream bug #40628 by Ryan C. Gordon diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c -index 997df43..8b660b4 100644 +index f0c9b46..dd9b7da 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -3327,7 +3327,7 @@ sock_connect(PySocketSockObject *s, PyObject *addro) @@ -577,17 +590,17 @@ index 997df43..8b660b4 100644 2.42.1 -From 06bddd0cdf4e2529a6cea35fc126ef5477f37b1c Mon Sep 17 00:00:00 2001 +From 30975e468052299321f077b82b3edd524f70db08 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Mon, 19 Oct 2020 18:03:09 +0200 Subject: ttyname_r can use MAXPATHLEN diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c -index 9ac021f..c77ba68 100644 +index e70fef5..df55963 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c -@@ -3112,11 +3112,14 @@ static PyObject * +@@ -3113,11 +3113,14 @@ static PyObject * os_ttyname_impl(PyObject *module, int fd) /*[clinic end generated code: output=c424d2e9d1cd636a input=9ff5a58b08115c55]*/ { @@ -607,7 +620,7 @@ index 9ac021f..c77ba68 100644 2.42.1 -From b5cd57a0b38a76ed5049e8335700df28580b649e Mon Sep 17 00:00:00 2001 +From 18c302be98981320722703994ec5969906b5fd1c Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Wed, 5 Oct 2022 16:09:41 -0300 Subject: The rest of korli's "initial Haiku patch". @@ -648,7 +661,7 @@ index ebe3711..63e2742 100644 # This is done to support downstream modifications where distributors change # the installation layout (eg. different site-packages directory). diff --git a/configure.ac b/configure.ac -index 52d5c1f..78567be 100644 +index bbe7f89..a42040f 100644 --- a/configure.ac +++ b/configure.ac @@ -1503,6 +1503,16 @@ if test $enable_shared = "yes"; then @@ -694,7 +707,7 @@ index 52d5c1f..78567be 100644 # -u libsys_s pulls in all symbols in libsys Darwin/*) LINKFORSHARED="$extra_undefs -framework CoreFoundation" -@@ -5352,6 +5363,7 @@ AC_CHECK_FUNC(__fpu_control, +@@ -5353,6 +5364,7 @@ AC_CHECK_FUNC(__fpu_control, AC_SUBST(LIBM) case $ac_sys_system in Darwin) ;; @@ -703,7 +716,7 @@ index 52d5c1f..78567be 100644 esac AC_MSG_CHECKING(for --with-libm=STRING) diff --git a/setup.py b/setup.py -index 4f122b6..dc42f39 100644 +index ad8fb81..07fd69f 100644 --- a/setup.py +++ b/setup.py @@ -84,6 +84,7 @@ CYGWIN = (HOST_PLATFORM == 'cygwin') @@ -714,7 +727,7 @@ index 4f122b6..dc42f39 100644 EMSCRIPTEN = HOST_PLATFORM == 'emscripten-wasm32' CC = os.environ.get("CC") if not CC: -@@ -890,6 +891,11 @@ class PyBuildExt(build_ext): +@@ -891,6 +892,11 @@ class PyBuildExt(build_ext): with open(config_h) as file: self.config_h_vars = sysconfig.parse_config_h(file) @@ -730,7 +743,7 @@ index 4f122b6..dc42f39 100644 2.42.1 -From 9bfff6217e20682d79cbc465a0aecf900ba355f0 Mon Sep 17 00:00:00 2001 +From 7ef67128bb5adca7ade61158660cd0c0c0a15bda Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Mon, 24 Oct 2022 20:04:10 -0300 Subject: Lib/test: require the "largefile" usage flag for I/O heavy tests. @@ -741,7 +754,7 @@ This avoids needing several GBs of storage to run the tests (unless the "largefile" resource usage flag is enabled). diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py -index 7853705..ffde3a7 100644 +index 3dae789..1258c67 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -613,7 +613,7 @@ class IOTest(unittest.TestCase): @@ -767,10 +780,10 @@ index 3b0930f..c21f001 100644 'test requires %s bytes and a long time to run' % str(size)) else: diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py -index dfcf303..611d3c8 100644 +index 1867e8c..ab52b6a 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py -@@ -1007,7 +1007,7 @@ class LargeMmapTests(unittest.TestCase): +@@ -1009,7 +1009,7 @@ class LargeMmapTests(unittest.TestCase): unlink(TESTFN) def _make_test_file(self, num_zeroes, tail): @@ -783,7 +796,7 @@ index dfcf303..611d3c8 100644 2.42.1 -From 4d17c9efbc6546f643d7f4f2d30c2b9de93dcf2d Mon Sep 17 00:00:00 2001 +From 6168fba742823ca3ee1d36cb6201abeb33db74ff Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Tue, 7 Mar 2023 18:29:29 +0100 Subject: default schemes for Haiku @@ -870,7 +883,7 @@ index 63e2742..6ba9d18 100644 2.42.1 -From da95612a7296813a2b12c4d82bb8fbd335560072 Mon Sep 17 00:00:00 2001 +From 136a1494cf17d93146990f04b5679abaeae9fb31 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Fri, 10 Mar 2023 20:15:14 -0300 Subject: syncronize both _getuserbase() copies on site.py and sysconfig.py. @@ -898,3 +911,69 @@ index 6ba9d18..c3e8dbc 100644 -- 2.42.1 + +From 5a9d80c3b931b0101523081a548fecfa64b8b0de Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Sat, 10 Feb 2024 06:01:25 -0300 +Subject: Fix build on nightlies, following the addition of kqueue. + +See HaikuPorts issue #10001. + +diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c +index 8210269..5750d2c 100644 +--- a/Modules/selectmodule.c ++++ b/Modules/selectmodule.c +@@ -2588,13 +2588,20 @@ _select_exec(PyObject *m) + #ifdef EVFILT_SIGNAL + PyModule_AddIntConstant(m, "KQ_FILTER_SIGNAL", EVFILT_SIGNAL); + #endif ++#ifdef EVFILT_TIMER + PyModule_AddIntConstant(m, "KQ_FILTER_TIMER", EVFILT_TIMER); +- ++#endif + /* event flags */ + PyModule_AddIntConstant(m, "KQ_EV_ADD", EV_ADD); + PyModule_AddIntConstant(m, "KQ_EV_DELETE", EV_DELETE); ++#ifdef EV_ENABLE + PyModule_AddIntConstant(m, "KQ_EV_ENABLE", EV_ENABLE); ++#else ++ PyModule_AddIntConstant(m, "KQ_EV_ENABLE", 0); // "test_kqueue.py" assumes KQ_EV_ENABLE exists ++#endif ++#ifdef EV_DISABLE + PyModule_AddIntConstant(m, "KQ_EV_DISABLE", EV_DISABLE); ++#endif + PyModule_AddIntConstant(m, "KQ_EV_ONESHOT", EV_ONESHOT); + PyModule_AddIntConstant(m, "KQ_EV_CLEAR", EV_CLEAR); + +@@ -2627,14 +2634,28 @@ _select_exec(PyObject *m) + /* PROC filter flags */ + #ifdef EVFILT_PROC + PyModule_AddIntConstant(m, "KQ_NOTE_EXIT", NOTE_EXIT); ++#ifdef NOTE_FORK + PyModule_AddIntConstant(m, "KQ_NOTE_FORK", NOTE_FORK); ++#endif ++#ifdef NOTE_EXEC + PyModule_AddIntConstant(m, "KQ_NOTE_EXEC", NOTE_EXEC); ++#endif ++#ifdef NOTE_PCTRLMASK + PyModule_AddIntConstant(m, "KQ_NOTE_PCTRLMASK", NOTE_PCTRLMASK); ++#endif ++#ifdef NOTE_PDATAMASK + PyModule_AddIntConstant(m, "KQ_NOTE_PDATAMASK", NOTE_PDATAMASK); ++#endif + ++#ifdef NOTE_TRACK + PyModule_AddIntConstant(m, "KQ_NOTE_TRACK", NOTE_TRACK); ++#endif ++#ifdef NOTE_CHILD + PyModule_AddIntConstant(m, "KQ_NOTE_CHILD", NOTE_CHILD); ++#endif ++#ifdef NOTE_TRACKERR + PyModule_AddIntConstant(m, "KQ_NOTE_TRACKERR", NOTE_TRACKERR); ++#endif + #endif + + /* NETDEV filter flags */ +-- +2.42.1 + diff --git a/dev-lang/python/patches/python3.11_x86-3.11.7.patchset b/dev-lang/python/patches/python3.11_x86-3.11.7.patchset deleted file mode 100644 index 75a8f5bd2..000000000 --- a/dev-lang/python/patches/python3.11_x86-3.11.7.patchset +++ /dev/null @@ -1,41 +0,0 @@ -From f85c391be71e71e7d07d579aef5e059bd3df3fe6 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Sat, 3 Feb 2018 11:33:49 +0100 -Subject: Fix include paths for secondary x86 - -This helps python find libraries and dependencies properly (openssl, -etc), so a few more modules are enabled. - -It also fixes a crash because python would try to load the gcc2 libroot -even when built with gcc5. - -diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py -index 2b4f04c..dab556c 100644 ---- a/Lib/ctypes/util.py -+++ b/Lib/ctypes/util.py -@@ -286,6 +286,7 @@ elif os.name == "posix": - directory = directory.replace('%A', - os.path.dirname(os.path.abspath(sys.argv[0] or os.getcwd()))) - -+ directory = os.path.join(directory, "x86") - if not os.path.isdir(directory): - continue - -diff --git a/setup.py b/setup.py -index dc42f39..1c6db8f 100644 ---- a/setup.py -+++ b/setup.py -@@ -894,8 +894,8 @@ class PyBuildExt(build_ext): - # Haiku-specific library locations - if HAIKU: - self.inc_dirs += ['/boot/develop/headers/posix', -- '/boot/system/develop/headers'] -- self.lib_dirs += ['/boot/system/develop/lib'] -+ '/boot/system/develop/headers/x86'] -+ self.lib_dirs += ['/boot/system/develop/lib/x86'] - # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) - if HOST_PLATFORM in ['osf1', 'unixware7', 'openunix8']: - self.lib_dirs += ['/usr/ccs/lib'] --- -2.42.1 - diff --git a/dev-lang/python/python3.11-3.11.7.recipe b/dev-lang/python/python3.11-3.11.8.recipe similarity index 69% rename from dev-lang/python/python3.11-3.11.7.recipe rename to dev-lang/python/python3.11-3.11.8.recipe index fdb1ebe55..92e1e551d 100644 --- a/dev-lang/python/python3.11-3.11.7.recipe +++ b/dev-lang/python/python3.11-3.11.8.recipe @@ -13,18 +13,13 @@ LICENSE="Python" COPYRIGHT="1990-2023 Python Software Foundation" REVISION="1" SOURCE_URI="https://www.python.org/ftp/python/$portVersion/Python-$portVersion.tar.xz" -CHECKSUM_SHA256="18e1aa7e66ff3a58423d59ed22815a6954e53342122c45df20c96877c062b9b7" +CHECKSUM_SHA256="9e06008c8901924395bc1da303eac567a729ae012baa182ab39269f650383bb3" SOURCE_DIR="Python-$portVersion" pyShortVer="${portVersion%.*}" pyVersionCompat="$portVersion compat >= $pyShortVer" PATCHES="python$pyShortVer-$portVersion.patchset" -if [ "$secondaryArchSuffix" = _x86 ] ; then - PATCHES+=" - python${pyShortVer}_x86-$portVersion.patchset - " -fi ARCHITECTURES="all !x86_gcc2" SECONDARY_ARCHITECTURES="x86" @@ -93,10 +88,23 @@ BUILD_PREREQUIRES=" cmd:pkg_config$secondaryArchSuffix " +# For some reason, test_zoneinfo fails to find it when running the tests inside the chroot, +# but works when calling the test with an installed Python 3.nn TEST_REQUIRES=" timezone_data " +# If set to "yes", the resulting "_tests" package is around 30 MB in size. +packageTests="no" +if [ "$packageTests" = "yes" ]; then + PROVIDES_tests=" + python$pyShortVer${secondaryArchSuffix}_tests = $portVersion + " + REQUIRES_tests=" + python$pyShortVer$secondaryArchSuffix == $portVersion base + " +fi + BUILD() { autoreconf -fi @@ -119,25 +127,17 @@ BUILD() --with-ensurepip=no \ --with-readline=editline \ --with-system-expat \ - --with-system-ffi \ --with-tzpath=$dataDir/zoneinfo \ --without-static-libpython - # configure: WARNING: --with(out)-system-ffi is ignored on this platform # --with-lto # this one is too CPU/RAM intensive. - # prevent make from rebuilding stuff that requires python - touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h - - rm -f python - # Uncomment when doing repeated builds (for testing different flags/options). - # make clean + # echo "[.recipe] Cleaning before rebuild:" && make clean && rm -f python # NOTE: When using "--enable-optimizations" above, using "make $jobArgs" might be unreliable. # Can see several instances of, for example: # - # libgcov profiling error:/sources/Python-3.11.4/Objects/object.gcda:Merge mismatch for function 51 - # libgcov profiling error:/sources/Python-3.11.4/Parser/parser.gcda:Merge mismatch for function 83 + # libgcov profiling error:/sources/Python-3.xx.x/Objects/.gcda:Merge mismatch for function # # Build might end OK (with only some "missing profile" warnings later on), or it can fail # with something like: @@ -154,21 +154,25 @@ INSTALL() # altinstall avoids clobbering $prefix/bin/{2to3,idle3,pydoc3,python3,python3-config} make altinstall + # Remove this one for "make altinstall" Python versions on Haiku. rm $libDir/libpython3.so - # ToDo: use this instead? - # mv $libDir/libpython3.so $libDir/libpython$pyShortVer.so if [ "$targetArchitecture" = x86_gcc2 ]; then # On x86_gcc2, move lib-dynload to lib/python3.x/ mv $libDir/python$pyShortVer/lib-dynload $prefix/lib/python$pyShortVer/ fi - prepareInstalledDevelLibs libpython$pyShortVer + prepareInstalledDevelLib libpython$pyShortVer fixPkgconfig if [ "$targetArchitecture" = x86_gcc2 ]; then # fix pkgconfig to match configure flags sed -i -e 's,headers/x86,headers,' $developLibDir/pkgconfig/python*.pc fi + ## Provide symlink to libpython3.nn.so + # Having `libpython3.nn.so` can help software like CudaText (via python4delphi), for example, + # to detect the different Python versions available for runtime loading. + ln -sr $libDir/libpython${pyShortVer}.so.1.0 $libDir/libpython${pyShortVer}.so + mkdir -p $prefix/lib/python$pyShortVer/vendor-packages echo 'This directory contains packaged python modules.' \ >$prefix/lib/python$pyShortVer/vendor-packages/README @@ -176,10 +180,16 @@ INSTALL() mkdir -p $prefix/non-packaged/lib/python$pyShortVer mv $prefix/lib/python$pyShortVer/site-packages $prefix/non-packaged/lib/python$pyShortVer/ - # drop testsuite altogether; move to a separate package if needed - cd $prefix/lib/python$pyShortVer - rm -rf ctypes/test distutils/tests idlelib/idle_test lib2to3/tests \ - test tkinter/test unittest/test + if [ "$packageTests" = "yes" ]; then + packageEntries tests \ + $prefix/lib/python$pyShortVer/idlelib/idle_test \ + $prefix/lib/python$pyShortVer/test + else + # drop testsuite altogether + cd $prefix/lib/python$pyShortVer + rm -rf ctypes/test distutils/tests idlelib/idle_test lib2to3/tests test tkinter/test \ + unittest/test + fi } # Some of the test will crash, invoking the crash dialog, and will hang waiting for @@ -198,28 +208,42 @@ INSTALL() # the recipe's building environment at the moment (https://dev.haiku-os.org/ticket/10301) # To see the available test-runs options: -# > hp -E python3.11 -# > LIBRARY_PATH=/sources/Python-3.11.6:%A/lib:/boot/home/config/non-packaged/lib:/boot/home/config/lib:/boot/system/non-packaged/lib:/boot/system/lib python -m test --help +# > hp -E python3.nn +# > LIBRARY_PATH=/sources/Python-3.nn.n:%A/lib:/boot/home/config/non-packaged/lib:/boot/home/config/lib:/boot/system/non-packaged/lib:/boot/system/lib python -m test --help +# or just: +# > LD_PRELOAD=./libpython3.nn.so.1.0 python -m test --help # -# To only execute a particular test: -# > cd Lib/test -# > PYTHONPATH="../":$PYTHONPATH python -m test test_xxx +# To only execute a particular test (from the $sourceDir): +# +# > LD_PRELOAD=./libpython3.nn.so.1.0 python -m test test_datetime -W +# For reference, results on hrev57581 (64 bits): +# Total duration: 4 min 47 sec +# Total test files: run=429/410 failed=27 skipped=18 resource_denied=9 rerun=28 TEST() { # Remove tests data left-overs, if any: - rm -f -r /boot/system/cache/tmp/ - rm -f -d -r build/test_python* + # rm -f -r /boot/system/cache/tmp/ + # rm -f -d -r build/test_python* + make $jobArgs test EXTRATESTOPTS="--cleanup" local test_options=( # Use this to get same test order on different runs (actual value not important). - # --randseed 0 + --randseed 7858065 + + # Print the names of the 10 slowest tests. + --slowest # Possibly useful? # --tempdir=/another_drive/tmp # Enable/disable certain tests by "resource" type: - # -uall,-audio,-cpu,-curses,-decimal,-gui,-largefile,-network,-subprocess,-tzdata,-urlfetch + # -uall,-audio,-cpu,-curses,-decimal,-gui,-largefile,-network,-subprocess,-urlfetch + # make test --help says that "-unone" is the default, but the build is doing this: + # "resources: all,-audio,-gui,-largefile" instead. + # + # Let's be explicit to avoid surprises: + -unone,curses,tzdata # distutils is deprecated, and will be removed on 3.12. -x test_distutils @@ -235,21 +259,16 @@ TEST() # Many of the tests hang/stall. We have two options: # # 1- Manually remove the problematic test-cases. - # 2- Set a TIMEOUT. + # 2- Set a TIMEOUT (eg: --timeout=300). # # Option 1: Works, but requires manual identification/mainteinance. - # # Option 2: Doesn't requires maintaining a list of stalling tests, but: - # - Causes errors at the end of the run: - # "unmounting failed: Device/File/Resource Busy" - # - Leaves dangling threads running when the tests timeout: - # "Warning -- threading_cleanup() failed to cleanup 0 threads (count: 0, dangling: 2)" - # (or otherwise leaves the system in a weird state). - # - The time it takes to run the full suite largely increases, + # at the end of the test run it causes: + # - "unmounting failed: Device/File/Resource Busy" errors, as there are + # dangling threads running when the tests timeout (requiring `killall python`) + # - The time it takes to run the full suite largely increases. # - # For Option 2, use: "--timeout=300" - # - # Let's use Option 1, for now at least: + # Let's use Option 1, for now at least. # These hang reliably. -x test__xxsubinterpreters @@ -261,19 +280,20 @@ TEST() -x test_multiprocessing_main_handling -x test_multiprocessing_spawn -x test_multiprocessing - -x test_threaded_import # test_importlib/test_threaded_import -x test_socketserver + -x test_threaded_import # test_importlib/test_threaded_import # "test_asyncio" doesn't seems to runs reliably, even after individually skipping # all the problematic test-cases that could be identify by running them one by one. -x test_asyncio - # -x test_asyncio/test_base_events - # -x test_asyncio/test_buffered_proto.py # Exception on Exception handler. - # -x test_asyncio/test_events - # -x test_asyncio/test_sendfile - # -x test_asyncio/test_server # Exception on Exception handler. - # -x test_asyncio/test_sslproto # Exception on Exception handler. - # -x test_asyncio/test_streams + # The following are all under "test_asyncio/" + # -x test_base_events + # -x test_buffered_proto # Exception on Exception handler. + # -x test_events + # -x test_sendfile + # -x test_server # Exception on Exception handler. + # -x test_sslproto # Exception on Exception handler. + # -x test_streams # These not always hang/stall, but they do it enough to warrant skipping for now. -x test_imaplib @@ -289,6 +309,18 @@ TEST() # 3.11.7, these take way too much time (hang?) -x test_builtin -x test_importlib + + # 3.11.8 / 3.12.2 (hang on nightlies, at least) + -x test_httplib + -x test_httpservers + -x test_logging + -x test_pydoc + -x test_xmlrpc + + # Fails while outputing "ResourceWarning: unclosed