diff --git a/dev-lang/python/patches/python3.10-3.10.13.patchset b/dev-lang/python/patches/python3.10-3.10.14.patchset similarity index 86% rename from dev-lang/python/patches/python3.10-3.10.13.patchset rename to dev-lang/python/patches/python3.10-3.10.14.patchset index e403c319e..a0fbe405d 100644 --- a/dev-lang/python/patches/python3.10-3.10.13.patchset +++ b/dev-lang/python/patches/python3.10-3.10.14.patchset @@ -1,8 +1,14 @@ -From 4781398b4c191430fcdaa68b234e3923125973ab Mon Sep 17 00:00:00 2001 -From: Jerome Duval -Date: Thu, 10 Apr 2014 16:03:33 +0000 -Subject: initial Haiku patch +From 5be29419ed996bdc3b6545c3f7c5d4cf345e43ca Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Sun, 7 Apr 2024 00:24:39 -0300 +Subject: Initial Haiku patch. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +This combines: +- Original "initial Haiku patch" from Jérôme Duval. +- A variation of Adrien Destugues changes in setup.py from his x86 patch. diff --git a/Include/pyport.h b/Include/pyport.h index 6ab0ae4..ad8c45c 100644 @@ -152,10 +158,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 939893e..108918a 100644 +index 5302037..05d8dce 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 +176,7 @@ index 939893e..108918a 100644 return joinuser("~", ".local") -@@ -365,7 +373,14 @@ def getsitepackages(prefixes=None): +@@ -375,7 +383,14 @@ def getsitepackages(prefixes=None): if sys.platlibdir != "lib": libdirs.append("lib") @@ -186,7 +192,7 @@ index 939893e..108918a 100644 for libdir in libdirs: path = os.path.join(prefix, libdir, "python%d.%d" % sys.version_info[:2], -@@ -471,8 +486,16 @@ def enablerlcompleter(): +@@ -481,8 +496,16 @@ def enablerlcompleter(): # each interpreter exit when readline was already configured # through a PYTHONSTARTUP hook, see: # http://bugs.python.org/issue5845#msg198636 @@ -250,7 +256,7 @@ index 4269b0e..314aa75 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 51c31b9..baffc7d 100644 +index fa99dd8..c898c9f 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -141,7 +141,7 @@ BINDIR= @bindir@ @@ -362,10 +368,10 @@ index 0d69c29..02f692d 100644 #endif diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c -index 0762a8d..e104107 100644 +index be628a0..a4c555c 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c -@@ -7477,7 +7477,9 @@ PyInit__socket(void) +@@ -7483,7 +7483,9 @@ PyInit__socket(void) /* SOCK_RAW is marked as optional in the POSIX specification */ PyModule_AddIntMacro(m, SOCK_RAW); #endif @@ -493,7 +499,7 @@ index ac3be38..d8ce1f1 100644 esac AC_MSG_CHECKING(for --with-libm=STRING) diff --git a/setup.py b/setup.py -index a39610a..d928e3a 100644 +index a39610a..82b06a1 100644 --- a/setup.py +++ b/setup.py @@ -86,6 +86,7 @@ CYGWIN = (HOST_PLATFORM == 'cygwin') @@ -504,19 +510,26 @@ index a39610a..d928e3a 100644 CC = os.environ.get("CC") if not CC: CC = sysconfig.get_config_var("CC") -@@ -869,6 +870,11 @@ class PyBuildExt(build_ext): +@@ -869,6 +870,18 @@ class PyBuildExt(build_ext): with open(config_h) as file: self.config_h_vars = sysconfig.parse_config_h(file) + # Haiku-specific library locations + if HAIKU: -+ self.inc_dirs += ['/boot/develop/headers/posix', -+ '/boot/system/develop/headers'] -+ self.lib_dirs += ['/boot/system/develop/lib'] ++ self.inc_dirs += ['/boot/develop/headers/posix'] ++ # Are we on x86 32 bits?: ++ import platform ++ if platform.machine() == 'BePC': ++ self.inc_dirs += ['/boot/system/develop/headers/x86'] ++ self.lib_dirs += ['/boot/system/develop/lib/x86'] ++ else: ++ self.inc_dirs += ['/boot/system/develop/headers'] ++ self.lib_dirs += ['/boot/system/develop/lib'] ++ # 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'] -@@ -915,14 +921,14 @@ class PyBuildExt(build_ext): +@@ -915,14 +928,14 @@ class PyBuildExt(build_ext): extra_compile_args=['-DPy_BUILD_CORE_MODULE'], extra_objects=[shared_math], depends=['_math.h', shared_math], @@ -533,7 +546,7 @@ index a39610a..d928e3a 100644 # time libraries: librt may be needed for clock_gettime() time_libs = [] -@@ -936,7 +942,7 @@ class PyBuildExt(build_ext): +@@ -936,7 +949,7 @@ class PyBuildExt(build_ext): # libm is needed by delta_new() that uses round() and by accum() that # uses modf(). self.add(Extension('_datetime', ['_datetimemodule.c'], @@ -542,7 +555,7 @@ index a39610a..d928e3a 100644 extra_compile_args=['-DPy_BUILD_CORE_MODULE'])) # zoneinfo module self.add(Extension('_zoneinfo', ['_zoneinfo.c'], -@@ -1029,7 +1035,7 @@ class PyBuildExt(build_ext): +@@ -1029,7 +1042,7 @@ class PyBuildExt(build_ext): # # audioop needs libm for floor() in multiple functions. self.add(Extension('audioop', ['audioop.c'], @@ -551,7 +564,7 @@ index a39610a..d928e3a 100644 # CSV files self.add(Extension('_csv', ['_csv.c'])) -@@ -2272,7 +2278,7 @@ class PyBuildExt(build_ext): +@@ -2272,7 +2285,7 @@ class PyBuildExt(build_ext): # function my_sqrt() needs libm for sqrt() self.add(Extension('_ctypes_test', sources=['_ctypes/_ctypes_test.c'], @@ -560,7 +573,7 @@ index a39610a..d928e3a 100644 ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR") ffi_lib = None -@@ -2337,7 +2343,7 @@ class PyBuildExt(build_ext): +@@ -2337,7 +2350,7 @@ class PyBuildExt(build_ext): 'Modules', '_decimal', 'libmpdec'))] @@ -569,7 +582,7 @@ index a39610a..d928e3a 100644 sources = [ '_decimal/_decimal.c', '_decimal/libmpdec/basearith.c', -@@ -2594,7 +2600,7 @@ class PyBuildExt(build_ext): +@@ -2594,7 +2607,7 @@ class PyBuildExt(build_ext): )) def detect_nis(self): @@ -579,10 +592,10 @@ index a39610a..d928e3a 100644 return -- -2.42.1 +2.45.2 -From b51d29f667d2ad9ab68ffb81358f0e136590927d Mon Sep 17 00:00:00 2001 +From ee95dc6bf81ab8943b7b1f73198ad5dc311047c1 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Sun, 16 Apr 2017 10:05:42 +0200 Subject: fix for negative errnos @@ -617,20 +630,23 @@ index b852ad7..60d4a6e 100644 *--cur = Py_hexdigits[saved_errno % 16]; saved_errno /= 16; -- -2.42.1 +2.45.2 -From e77b7776a9946759441decd6ef9b1a2acc4f4ed5 Mon Sep 17 00:00:00 2001 -From: Philippe Houdoin -Date: Wed, 24 May 2017 11:09:43 +0000 +From 8454b0a55bfd324c5a33deec36fca564c144ca1c Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Sat, 6 Apr 2024 23:49:30 -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 32 bits. diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py -index 0c2510e..2b4f04c 100644 +index 0c2510e..371eaa5 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py -@@ -265,6 +265,56 @@ elif os.name == "posix": +@@ -265,6 +265,60 @@ elif os.name == "posix": def find_library(name, is64 = False): return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name)) @@ -655,6 +671,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 + @@ -687,7 +707,7 @@ index 0c2510e..2b4f04c 100644 else: def _findSoname_ldconfig(name): -@@ -367,6 +417,12 @@ def test(): +@@ -367,6 +421,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'))}") @@ -701,10 +721,10 @@ index 0c2510e..2b4f04c 100644 print(cdll.LoadLibrary("libm.so")) print(cdll.LoadLibrary("libcrypt.so")) -- -2.42.1 +2.45.2 -From e586cbdf3f65e55fc41d243f1f0fa10371e77f1f Mon Sep 17 00:00:00 2001 +From ee96d705bca4b4623acb1133cf371e68e9b29c23 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 @@ -727,10 +747,10 @@ index ec3cece..6a29d2a 100755 # Prefer X browsers if present if os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"): -- -2.42.1 +2.45.2 -From 7e20a6702a95b6563f89f85e498a38101bb00fcc Mon Sep 17 00:00:00 2001 +From 390b9112392e602714714c8bb0275beee85914fe 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. @@ -750,10 +770,10 @@ index d1d4333..bfe60ca 100644 pass # no-op when os.register_at_fork does not exist. else: -- -2.42.1 +2.45.2 -From 6fdcf566f78f6f45dce16e3d096622bf1700ed52 Mon Sep 17 00:00:00 2001 +From e7fd48e40d2073832aa88d80d4755fdb97d640fe 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() @@ -761,7 +781,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 e104107..383ba52 100644 +index a4c555c..abdaea7 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -3291,7 +3291,7 @@ sock_connect(PySocketSockObject *s, PyObject *addro) @@ -783,10 +803,10 @@ index e104107..383ba52 100644 return PyLong_FromLong((long) res); -- -2.42.1 +2.45.2 -From a5e977b94263d2e4eaef9af5ecb369c048a1c0b3 Mon Sep 17 00:00:00 2001 +From 8b5a4fbbc0e540ce1d46543ffbfe4146fd5b4e55 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 @@ -813,10 +833,10 @@ index c0421a9..ace1449 100644 if (buffer == NULL) { return PyErr_NoMemory(); -- -2.42.1 +2.45.2 -From 3cf1b4ca1040bb0bfa3133312955da2aa8b71a6e Mon Sep 17 00:00:00 2001 +From d05bb022b795698408259c6d01778679958000a0 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Fri, 21 Oct 2022 19:58:50 -0300 Subject: Lib/test: require the "largefile" usage flag for I/O heavy tests. @@ -853,10 +873,10 @@ index 8f6bec1..dcd9678 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 8f34c18..999063f 100644 +index 307e2b9..afc1772 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py -@@ -806,7 +806,7 @@ class LargeMmapTests(unittest.TestCase): +@@ -811,7 +811,7 @@ class LargeMmapTests(unittest.TestCase): unlink(TESTFN) def _make_test_file(self, num_zeroes, tail): @@ -866,10 +886,10 @@ index 8f34c18..999063f 100644 'test requires %s bytes and a long time to run' % str(0x180000000)) f = open(TESTFN, 'w+b') -- -2.42.1 +2.45.2 -From 21de43bde7cf895f01108bda42a927e9539c0f25 Mon Sep 17 00:00:00 2001 +From ed496bf46d87bbefb6e458d0379766187cf95262 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Tue, 7 Mar 2023 18:29:29 +0100 Subject: default schemes for Haiku @@ -953,10 +973,10 @@ index 4f92119..919d883 100644 return { 'prefix': 'nt', -- -2.42.1 +2.45.2 -From 7f34f1d66bc5045f56b1e92d17c7505dd83ba229 Mon Sep 17 00:00:00 2001 +From 35afca4e9dcc0db07ee81c86ee526bb56ff11128 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. @@ -982,10 +1002,10 @@ index 919d883..c306d43 100644 _HAS_USER_BASE = (_getuserbase() is not None) -- -2.42.1 +2.45.2 -From 97fdcd74f0beede67fa3c1e811ad4134ff25ef68 Mon Sep 17 00:00:00 2001 +From 04abc5b32668d7119eeb161c2695c726eaa27a1d Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Sat, 27 Jan 2024 08:14:52 -0300 Subject: Apply gh-109191 from Python upstream. @@ -1075,10 +1095,10 @@ index 57c84e5..6d4f5fc 100644 #undef HAVE_RL_COMPLETION_APPEND_CHARACTER -- -2.42.1 +2.45.2 -From 70238524a2232164abfc759364c37c107d3d0854 Mon Sep 17 00:00:00 2001 +From 7cca300611c2b2ed11332d3140d01254ba00ab1c 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. @@ -1086,7 +1106,7 @@ Subject: Fix build on nightlies, following the addition of kqueue. Together with the patch for gh-109191, fixes HaikuPorts issue #10001. diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c -index 3afcb0e..900b2a0 100644 +index 3afcb0e..b7a2681 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -2570,13 +2570,20 @@ _select_exec(PyObject *m) @@ -1141,5 +1161,91 @@ index 3afcb0e..900b2a0 100644 /* NETDEV filter flags */ -- -2.42.1 +2.45.2 + + +From 678220941448888e3f74de8c2591fa46d6d5e455 Mon Sep 17 00:00:00 2001 +From: Alexander von Gluck IV +Date: Thu, 14 Mar 2024 12:54:33 -0500 +Subject: config.guess: Update to universal haiku arch guessing + +* Matches upstream config.guess as of 2022, python just + ships a really old one + +diff --git a/config.guess b/config.guess +index e81d3ae..366429c 100755 +--- a/config.guess ++++ b/config.guess +@@ -1364,8 +1364,11 @@ EOF + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; +- x86_64:Haiku:*:*) +- GUESS=x86_64-unknown-haiku ++ ppc:Haiku:*:*) ++ GUESS=powerpc-apple-haiku ++ ;; ++ *:Haiku:*:*) ++ GUESS=$UNAME_MACHINE-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE +-- +2.45.2 + + +From 1c1c7f12bdde12c8c8650e8ffdf30febc46f4c74 Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Sun, 14 Jul 2024 13:32:13 -0300 +Subject: Add missing 'platinclude' to sysconfig's _INSTALL_SCHEMES. + + +diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py +index c306d43..8bdfa7b 100644 +--- a/Lib/sysconfig.py ++++ b/Lib/sysconfig.py +@@ -62,6 +62,7 @@ _INSTALL_SCHEMES = { + 'purelib': '{base}/non-packaged/lib/python{py_version_short}/site-packages', + 'platlib': '{platbase}/non-packaged/{platlibdir}/python{py_version_short}/site-packages', + 'include': '{base}/non-packaged/develop/headers/python{py_version_short}', ++ 'platinclude': '{base}/non-packaged/develop/headers/python{py_version_short}', + 'scripts': '{base}/non-packaged/bin', + 'data' : '{base}/non-packaged', + }, +@@ -71,6 +72,7 @@ _INSTALL_SCHEMES = { + 'purelib': '{base}/lib/python{py_version_short}/vendor-packages', + 'platlib': '{platbase}/lib/python{py_version_short}/vendor-packages', + 'include': '{base}/develop/headers/python{py_version_short}', ++ 'platinclude': '{base}/develop/headers/python{py_version_short}', + 'scripts': '{base}/bin', + 'data' : '{base}', + }, +-- +2.45.2 + + +From ecc79918bbcae65e4f0ae238df40ed0c6bf43d6d Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Sun, 14 Jul 2024 15:18:13 -0300 +Subject: Adjust test_sysconfig.test_get_scheme_names for Haiku. + + +diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py +index 5ee9839..35727c6 100644 +--- a/Lib/test/test_sysconfig.py ++++ b/Lib/test/test_sysconfig.py +@@ -263,9 +263,9 @@ class TestSysConfig(unittest.TestCase): + self.assertTrue(os.path.isfile(config_h), config_h) + + def test_get_scheme_names(self): +- wanted = ['nt', 'posix_home', 'posix_prefix'] ++ wanted = ['nt', 'posix_home', 'posix_prefix', 'haiku', 'haiku_vendor', 'haiku_home'] + if HAS_USER_BASE: +- wanted.extend(['nt_user', 'osx_framework_user', 'posix_user']) ++ wanted.extend(['nt_user', 'osx_framework_user', 'posix_user', 'haiku_user']) + self.assertEqual(get_scheme_names(), tuple(sorted(wanted))) + + @skip_unless_symlink +-- +2.45.2 diff --git a/dev-lang/python/patches/python3.10_x86-3.10.13.patchset b/dev-lang/python/patches/python3.10_x86-3.10.13.patchset deleted file mode 100644 index a235272c7..000000000 --- a/dev-lang/python/patches/python3.10_x86-3.10.13.patchset +++ /dev/null @@ -1,45 +0,0 @@ -From 672ea87bdc26e47c81052cecc9cfde9f4c7467a7 Mon Sep 17 00:00:00 2001 -From: Adrien Destugues -Date: Sat, 3 Feb 2018 11:33:49 +0100 -Subject: [PATCH] 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. ---- - Lib/ctypes/util.py | 1 + - setup.py | 4 ++-- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py -index b2e4095..34e56aa 100644 ---- a/Lib/ctypes/util.py -+++ b/Lib/ctypes/util.py -@@ -273,6 +273,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 704e7ec..f480cc9 100644 ---- a/setup.py -+++ b/setup.py -@@ -696,8 +696,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.23.0 - diff --git a/dev-lang/python/python3.10-3.10.13.recipe b/dev-lang/python/python3.10-3.10.14.recipe similarity index 70% rename from dev-lang/python/python3.10-3.10.13.recipe rename to dev-lang/python/python3.10-3.10.14.recipe index 704056174..e6363ea7b 100644 --- a/dev-lang/python/python3.10-3.10.13.recipe +++ b/dev-lang/python/python3.10-3.10.14.recipe @@ -10,21 +10,16 @@ Python is free to use, even for commercial products, because of its \ OSI-approved open source license." HOMEPAGE="https://www.python.org" LICENSE="Python" -COPYRIGHT="1990-2023 Python Software Foundation" -REVISION="3" +COPYRIGHT="1990-2024 Python Software Foundation" +REVISION="1" SOURCE_URI="https://www.python.org/ftp/python/$portVersion/Python-$portVersion.tar.xz" -CHECKSUM_SHA256="5c88848668640d3e152b35b4536ef1c23b2ca4bd2c957ef1ecbb053f571dd3f6" +CHECKSUM_SHA256="9c50481faa8c2832329ba0fc8868d0a606a680fc4f60ec48d26ce8e076751fda" 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" @@ -43,7 +38,6 @@ GLOBAL_WRITABLE_FILES=" PROVIDES=" python$pyShortVer$secondaryArchSuffix = $pyVersionCompat - python310$secondaryArchSuffix = $pyVersionCompat cmd:2to3_$pyShortVer = $pyVersionCompat cmd:idle$pyShortVer = $pyVersionCompat cmd:pydoc$pyShortVer = $pyVersionCompat @@ -60,6 +54,7 @@ PROVIDES=" " REQUIRES=" haiku$secondaryArchSuffix + timezone_data cmd:file lib:libbz2$secondaryArchSuffix lib:libedit$secondaryArchSuffix @@ -68,8 +63,8 @@ REQUIRES=" lib:libintl$secondaryArchSuffix lib:liblzma$secondaryArchSuffix lib:libncurses$secondaryArchSuffix - lib:libssl$secondaryArchSuffix lib:libsqlite3$secondaryArchSuffix + lib:libssl$secondaryArchSuffix lib:libz$secondaryArchSuffix " REPLACES=" @@ -85,8 +80,8 @@ BUILD_REQUIRES=" devel:libncurses$secondaryArchSuffix devel:libsqlite3$secondaryArchSuffix devel:libssl$secondaryArchSuffix - devel:libtclstub8.6$secondaryArchSuffix - devel:libtk8.6$secondaryArchSuffix +# devel:libtclstub8.6$secondaryArchSuffix # "Disable" these two, as tkinter deadlocks on Haiku. +# devel:libtk8.6$secondaryArchSuffix # Try again when libtk drops undroidwish for xlibe. devel:libz$secondaryArchSuffix " BUILD_PREREQUIRES=" @@ -101,6 +96,17 @@ BUILD_PREREQUIRES=" cmd:pkg_config$secondaryArchSuffix " +# 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() { autoupdate @@ -124,17 +130,13 @@ BUILD() --with-ensurepip=no \ --with-readline=editline \ --with-system-expat \ - --with-system-ffi - # configure: WARNING: --with(out)-system-ffi is ignored on this platform + --with-tzpath=$dataDir/zoneinfo # --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). + # echo "[.recipe] Cleaning before rebuild:" && make clean && rm -f python # NOTE: When using "--enable-optimizations" above, using "make $jobArgs" might be unreliable. - # make clean # Uncomment when doing repeated builds (for testing different flags/options). make $jobArgs } @@ -148,7 +150,7 @@ INSTALL() # 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 @@ -162,10 +164,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 \ - sqlite3/test 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 sqlite3/test test \ + tkinter/test unittest/test + fi } # Some of the test will crash, invoking the crash dialog, and will hang waiting for @@ -173,7 +181,7 @@ INSTALL() # the following lines in the file "~/config/settings/system/debug_server/settings": ##--- # executable_actions { -# /sources/Python-3*/python kill +# /sources/Python-3.*/python kill # } ##--- @@ -183,23 +191,51 @@ INSTALL() # But that needs support from Haiku's debug_server, as we can't change settings from # the recipe's building environment at the moment (https://dev.haiku-os.org/ticket/10301) -# For reference, tests results on hrev57578 (x64): 351 tests OK. 30 tests failed. 19 tests skipped. +# To see the available test-runs options: +# > hp -E python3.nn +# > LIBRARY_PATH=%A:/boot/system/lib python -m test --help +# or: +# > LD_PRELOAD=./libpython3.nn.so.1.0 python -m test --help +# +# To only execute a particular test (from the $sourceDir): +# +# > LD_PRELOAD=./libpython3.nn.so.1.0 python -m test test_datetime -W +# +# Beware that running test that way can cause some test to fail, while they work fine under +# "hp --test"'s chroot. (test_sysconfig.MakefileTests.test_parse_makefile, for example). +# Problem is "os.getcwd()" will return wrong data, causing some file operations to fail. + +# For reference... Tests results on beta4 (x64): +# 25 test ommited. 320 tests OK. 24 tests failed. 27 tests skipped. +# On verbose re-run stage: +# 25 test ommited. 323 tests OK. 21 tests failed. 27 tests skipped. 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 8668208 + --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 + ) + local tests_to_exclude=( # distutils is deprecated, and will be removed on 3.12. -x test_distutils @@ -266,10 +302,48 @@ TEST() -x test_httpservers -x test_logging -x test_xmlrpc + + # These hang at least once on beta4. + -x test_docxmlrpc + -x test_wsgiref # low/no CPU usage. + -x test_poplib # mid/high CPU usage. + -x test_ftplib # segfaults sometimes? + -x test_smtplib # timeouts sometimes, others, hangs? + -x test_eintr # sometimes runs, others hangs. Seems related to file locking. + ) + + local tests_that_fail=( + test_asyncore + test_builtin + test_c_locale_coercion + test_compileall + test_ctypes + test_datetime + test_fcntl + test_genericpath + test_json + test_mailbox + test_os + test_pathlib + test_popen + test_posix + test_pty + test_re + test_readline + test_shutil + test_site + test_tarfile + test_time + test_tools + test_utf8_mode ) local -x LOGNAME=buildbot # this skips tests_tools/test_freeze, copied from Gentoo's ebuild - make $jobArgs test EXTRATESTOPTS="${test_options[*]}" + + # This runs the full test suite (minus the tests that we explicitly exclude). + make $jobArgs test EXTRATESTOPTS="${test_options[*]} ${tests_to_exclude[*]}" + # Use this instead, to only run the tests that fail: + # make $jobArgs test EXTRATESTOPTS="${test_options[*]} ${tests_that_fail[*]}" # Occasionally, some test fails seemingly due to the racy nature of tempfile.mktemp(). # Even the help for that function says to NOT use it, but some tests still do.