From f2f2723b8db270d71c28b699bf66ecbf1e61b788 Mon Sep 17 00:00:00 2001 From: OscarL Date: Tue, 17 Sep 2024 12:53:55 -0300 Subject: [PATCH] python3.12: update to version 3.12.6. (#11122) --- ....4.patchset => python3.12-3.12.6.patchset} | 240 +++++++++++++++--- ...3.12.4.recipe => python3.12-3.12.6.recipe} | 181 ++++++++----- 2 files changed, 330 insertions(+), 91 deletions(-) rename dev-lang/python/patches/{python3.12-3.12.4.patchset => python3.12-3.12.6.patchset} (79%) rename dev-lang/python/{python3.12-3.12.4.recipe => python3.12-3.12.6.recipe} (71%) diff --git a/dev-lang/python/patches/python3.12-3.12.4.patchset b/dev-lang/python/patches/python3.12-3.12.6.patchset similarity index 79% rename from dev-lang/python/patches/python3.12-3.12.4.patchset rename to dev-lang/python/patches/python3.12-3.12.6.patchset index 41e6654a0..e6b3f1c8b 100644 --- a/dev-lang/python/patches/python3.12-3.12.4.patchset +++ b/dev-lang/python/patches/python3.12-3.12.6.patchset @@ -1,4 +1,4 @@ -From 91fcc766ffa94f609e0bcbdf440c6032e56f904e Mon Sep 17 00:00:00 2001 +From 94f044767b77d2e5436b85dd6c06e3f053ad9908 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Sun, 8 Oct 2023 01:02:25 -0300 Subject: initial Haiku patch @@ -32,7 +32,7 @@ index 0000000..4372ee2 +set -v +eval $PYTHON_FOR_BUILD ../../Tools/scripts/h2py.py -i "'(u_long)'" $HEADERS/posix/netinet/in.h diff --git a/Makefile.pre.in b/Makefile.pre.in -index 4a957fb..2d5cbcc 100644 +index 0e64ccc..f3032c3 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -147,7 +147,7 @@ BINDIR= @bindir@ @@ -184,7 +184,7 @@ index 13f1115..45f477c 100644 else PyErr_SetString(PyExc_KeyError, "getspnam(): name not found"); diff --git a/configure.ac b/configure.ac -index 8a32cb5..3e89457 100644 +index 0d6df8e..a85e431 100644 --- a/configure.ac +++ b/configure.ac @@ -1524,6 +1524,16 @@ if test $enable_shared = "yes"; then @@ -242,7 +242,7 @@ index 8a32cb5..3e89457 100644 2.45.2 -From b2cb235d39502638956efdbbf7fedbc81499f72d Mon Sep 17 00:00:00 2001 +From ad34f4d68d338d042490c7b455b689ac357c2d5d Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Sun, 16 Apr 2017 10:05:42 +0200 Subject: fix for negative errnos @@ -280,7 +280,7 @@ index 35ea2ac..ccc25ed 100644 2.45.2 -From 5ddac642fb5e6f9c47b3fa055d6623b40d62520d Mon Sep 17 00:00:00 2001 +From 9e5fadd7fc838286ac17b319dd42d6ed66b5f2ea 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 @@ -377,17 +377,17 @@ index c550883..6b23423 100644 2.45.2 -From 07884d11a7e06ce5c648357e61e22f049ebc826c Mon Sep 17 00:00:00 2001 +From 49dd426f78da08ed6bceb39d706cf59155d65ec7 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 ba6711e..ba543ab 100755 +index 13b9e85..7d81178 100755 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py -@@ -477,6 +477,12 @@ def register_standard_browsers(): +@@ -480,6 +480,12 @@ def register_standard_browsers(): # SerenityOS webbrowser, simply called "Browser". register("Browser", None, BackgroundBrowser("Browser")) @@ -404,7 +404,7 @@ index ba6711e..ba543ab 100755 2.45.2 -From db43569939664fbd43fc89da29481a6ca100b705 Mon Sep 17 00:00:00 2001 +From 188f515c46a4a0f581c24dc93ae890a323643a9d 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. @@ -427,7 +427,7 @@ index 22d3198..f369a88 100644 2.45.2 -From 5e457b2ab1ec159f441fdb714e95ae4d1dce970f Mon Sep 17 00:00:00 2001 +From 40dd67671bc97d1d7c1204e2a46ce11e01cdd968 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() @@ -460,14 +460,14 @@ index 9724879..f714ed8 100644 2.45.2 -From 662f057c3b9cf8f81d55ba4518c71a640b587a97 Mon Sep 17 00:00:00 2001 +From 1ca2d28caa2ecaefd88a19afc6155a89dcdeea21 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 9cc53c8..efe83f4 100644 +index 2277cae..365ce3f 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3249,11 +3249,14 @@ static PyObject * @@ -490,7 +490,7 @@ index 9cc53c8..efe83f4 100644 2.45.2 -From bde99c8775e120a51ede13921aaa473699b6aa59 Mon Sep 17 00:00:00 2001 +From 84387b230b47b9f2fce0e395d3eeea43ad51fd14 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. @@ -501,7 +501,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 daa40a6..1a49ab2 100644 +index 8b68653..5aede8c 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -634,7 +634,7 @@ class IOTest(unittest.TestCase): @@ -514,10 +514,10 @@ index daa40a6..1a49ab2 100644 'largefile', 'test requires %s bytes and a long time to run' % self.LARGE) diff --git a/Lib/test/test_largefile.py b/Lib/test/test_largefile.py -index 3b0930f..c793ea1 100644 +index 282400c..6448a8d 100644 --- a/Lib/test/test_largefile.py +++ b/Lib/test/test_largefile.py -@@ -255,7 +255,7 @@ def setUpModule(): +@@ -274,7 +274,7 @@ def setUpModule(): # takes a long time to build the >2 GiB file and takes >2 GiB of disk # space therefore the resource must be enabled to run this test. # If not, nothing after this line stanza will be executed. @@ -543,7 +543,7 @@ index 1867e8c..e4fab02 100644 2.45.2 -From 27d9c9a14b97c392ba739b57176640f0520072b6 Mon Sep 17 00:00:00 2001 +From 6156deb2f3bc6b43cde398b9a6d10a3d49d6e357 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Fri, 26 Jul 2024 19:18:56 -0300 Subject: _getuserbase(), getsitepackages(), and INSTALL_SCHEMES for Haiku. @@ -570,7 +570,7 @@ by me, plus: The idea was to have all _getuserbase()/INSTALL_SCHEMES related changes in "one place". diff --git a/Lib/site.py b/Lib/site.py -index 924cfbe..5f3f5da 100644 +index 924cfbe..3863055 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -302,6 +302,14 @@ def _getuserbase(): @@ -610,7 +610,7 @@ index 924cfbe..5f3f5da 100644 + _home_prefix = subprocess.check_output( + ['finddir', 'B_USER_CONFIG_DIRECTORY']).rstrip().decode('utf-8') + except: -+ print("'finddir B_USER_CONFIG_DIRECTORY' failed.") ++ # print("'finddir B_USER_CONFIG_DIRECTORY' failed.") + _home_prefix = None + + if _home_prefix is not None: @@ -622,7 +622,7 @@ index 924cfbe..5f3f5da 100644 if sys.platlibdir != "lib": libdirs.append("lib") diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py -index 122d441..f491415 100644 +index 122d441..55e13c4 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -47,6 +47,36 @@ _INSTALL_SCHEMES = { @@ -759,7 +759,7 @@ index 1137c20..575e4e5 100644 2.45.2 -From c3aa3d84811cc4d9a6e6803ec1cb767ad4b237cf Mon Sep 17 00:00:00 2001 +From d90396e18308b22a1a47a91296731a8ea1bacac1 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Fri, 26 Jul 2024 19:01:05 -0300 Subject: Fix location of REPL's history file. @@ -770,7 +770,7 @@ Content-Transfer-Encoding: 8bit From "initial Haiku patch" by Jérôme Duval. diff --git a/Lib/site.py b/Lib/site.py -index 5f3f5da..6dea062 100644 +index 3863055..da608bd 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -518,8 +518,16 @@ def enablerlcompleter(): @@ -796,7 +796,7 @@ index 5f3f5da..6dea062 100644 2.45.2 -From c3abf4b23c9810536c3c02bade51284173049133 Mon Sep 17 00:00:00 2001 +From 38533600230ef9bec7d8a99f0760665a2f690ff2 Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Sun, 8 Oct 2023 17:02:19 -0300 Subject: Use spawn instead of fork for multiprocessing. @@ -849,7 +849,7 @@ index de8a264..02a301e 100644 2.45.2 -From 700d8924d4ec7b7d9a5d4b0c6a18903e7c12b6c2 Mon Sep 17 00:00:00 2001 +From e1b37fe32fcf2b17dafec1efd5dfe860c46d373b Mon Sep 17 00:00:00 2001 From: Oscar Lesta Date: Sun, 10 Dec 2023 19:50:22 -0300 Subject: Miscellaneous "Lib/test/" fixes for Haiku. @@ -860,10 +860,10 @@ Content-Transfer-Encoding: 8bit test_fileio.py fix from "initial Haiku patch" by Jérôme Duval. diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py -index 404894a..9fee3f7 100644 +index 0528e07..0885bc6 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py -@@ -5921,6 +5921,9 @@ def pairs(iterable): +@@ -5926,6 +5926,9 @@ def pairs(iterable): class ZoneInfo(tzinfo): zoneroot = '/usr/share/zoneinfo' @@ -889,7 +889,7 @@ index ebfcffd..0517b87 100644 2.45.2 -From 4cafbc8ddd4c7c4f982bdba23991328a96964d5d Mon Sep 17 00:00:00 2001 +From c1134b6f49f4a0c53be2a0334ca24b8db5c5e6bd 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. @@ -897,7 +897,7 @@ 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 97f1db2..17bc54c 100644 +index 50788e5..82fd9d9 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -2722,13 +2722,20 @@ _select_exec(PyObject *m) @@ -955,7 +955,7 @@ index 97f1db2..17bc54c 100644 2.45.2 -From 8d881ebce1d3948d0d9b1b64cf92c01ced88aea8 Mon Sep 17 00:00:00 2001 +From 76dd51e3429bdb55f0daeccb9a9945903aa4d0a2 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 @@ -984,3 +984,185 @@ index e81d3ae..366429c 100755 -- 2.45.2 + +From 0fdc0ab08ce964d27122139a9621dd5441fdb074 Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Fri, 9 Aug 2024 13:38:28 -0300 +Subject: fix test_utf8_mode. + + +diff --git a/Lib/test/test_utf8_mode.py b/Lib/test/test_utf8_mode.py +index f668810..a55a8e4 100644 +--- a/Lib/test/test_utf8_mode.py ++++ b/Lib/test/test_utf8_mode.py +@@ -226,7 +226,7 @@ class UTF8ModeTests(unittest.TestCase): + with self.subTest(LC_ALL=loc): + check('utf8', [arg_utf8], LC_ALL=loc) + +- if sys.platform == 'darwin' or support.is_android or VXWORKS: ++ if sys.platform == 'darwin' or support.is_android or VXWORKS or sys.platform[:5] == 'haiku': + c_arg = arg_utf8 + elif sys.platform.startswith("aix"): + c_arg = arg.decode('iso-8859-1') +-- +2.45.2 + + +From a928a72ce3a70d3c0babd0f922809bdeb821fbd0 Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Fri, 9 Aug 2024 14:35:04 -0300 +Subject: Fix test_site. + +test_site expects a specific set of modules to be imported. +By importing "subprocess" (for calling `finddir`) we end up breaking +that assumption. + +Also, site.py should avoid costly imports to help startup times. + +Hardcoding a few paths avoids having to import subprocess, that +causes many other subsequent imports. + +diff --git a/Lib/site.py b/Lib/site.py +index da608bd..d11f972 100644 +--- a/Lib/site.py ++++ b/Lib/site.py +@@ -303,12 +303,8 @@ def _getuserbase(): + "%d.%d" % sys.version_info[:2]) + + if sys.platform.startswith('haiku'): +- try: +- import subprocess +- return subprocess.check_output( +- ['finddir', 'B_USER_NONPACKAGED_DIRECTORY']).rstrip().decode('utf-8') +- except: +- pass ++ # 'B_USER_NONPACKAGED_DIRECTORY' ++ return joinuser("~", "config", "non-packaged") + + return joinuser("~", ".local") + +@@ -402,16 +398,8 @@ def getsitepackages(prefixes=None): + # For .hpkg installed under ~/config/ (pkgman install -H) + # ("pip install --user" uses ~/config/non-packaged/, and gets + # handled by the "haiku_user" install scheme. +- try: +- import subprocess +- _home_prefix = subprocess.check_output( +- ['finddir', 'B_USER_CONFIG_DIRECTORY']).rstrip().decode('utf-8') +- except: +- # print("'finddir B_USER_CONFIG_DIRECTORY' failed.") +- _home_prefix = None +- +- if _home_prefix is not None: +- sitepackages.append(os.path.join(_home_prefix, "lib", ++ _home_prefix = os.path.expanduser(os.path.join("~", "config")) ++ sitepackages.append(os.path.join(_home_prefix, "lib", + "python%d.%d" % sys.version_info[:2], + "vendor-packages")) + elif os.sep == '/': +diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py +index 1a9c81d..09e612f 100644 +--- a/Lib/test/test_site.py ++++ b/Lib/test/test_site.py +@@ -322,7 +322,21 @@ class HelperFunctionsTests(unittest.TestCase): + def test_getsitepackages(self): + site.PREFIXES = ['xoxo'] + dirs = site.getsitepackages() +- if os.sep == '/': ++ if sys.platform[:5] == 'haiku': ++ self.assertEqual(len(dirs), 3) # site-packages + sys/user vendor-packages ++ wanted = os.path.join('xoxo', 'non-packaged', 'lib', ++ 'python%d.%d' % sys.version_info[:2], ++ 'site-packages') ++ self.assertEqual(dirs[0], wanted) ++ wanted = os.path.join('xoxo', sys.platlibdir, ++ 'python%d.%d' % sys.version_info[:2], ++ 'vendor-packages') ++ self.assertEqual(dirs[1], wanted) ++ wanted = os.path.join('xoxo', os.path.expanduser('~/config'), 'lib', ++ 'python%d.%d' % sys.version_info[:2], ++ 'vendor-packages') ++ self.assertEqual(dirs[2], wanted) ++ elif os.sep == '/': + # OS X, Linux, FreeBSD, etc + if sys.platlibdir != "lib": + self.assertEqual(len(dirs), 2) +-- +2.45.2 + + +From 10db21f1709a4155d9737f7dac526e542e4537be Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Fri, 9 Aug 2024 15:37:13 -0300 +Subject: Fix test_sysconfig. + + +diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py +index 575e4e5..18f73b3 100644 +--- a/Lib/test/test_sysconfig.py ++++ b/Lib/test/test_sysconfig.py +@@ -201,6 +201,19 @@ class TestSysConfig(unittest.TestCase): + sysconfig.get_path('purelib', scheme='venv'), + sysconfig.get_path('purelib', scheme='nt_venv') + ) ++ elif sys.platform[:5] == 'haiku': ++ self.assertEqual( ++ sysconfig.get_path('scripts', scheme='venv'), ++ sysconfig.get_path('scripts', scheme='haiku_venv') ++ ) ++ self.assertEqual( ++ sysconfig.get_path('include', scheme='venv'), ++ sysconfig.get_path('include', scheme='haiku_venv') ++ ) ++ self.assertEqual( ++ sysconfig.get_path('purelib', scheme='venv'), ++ sysconfig.get_path('purelib', scheme='haiku_venv') ++ ) + else: + self.assertEqual( + sysconfig.get_path('scripts', scheme='venv'), +@@ -345,7 +358,7 @@ class TestSysConfig(unittest.TestCase): + + def test_get_scheme_names(self): + wanted = ['nt', 'posix_home', 'posix_prefix', 'posix_venv', 'nt_venv', 'venv', 'haiku', +- 'haiku_home', 'haiku_vendor'] ++ 'haiku_home', 'haiku_vendor', 'haiku_venv'] + if HAS_USER_BASE: + wanted.extend(['nt_user', 'osx_framework_user', 'posix_user', 'haiku_user']) + self.assertEqual(get_scheme_names(), tuple(sorted(wanted))) +-- +2.45.2 + + +From 9a3687667dd0e5ffd65a072b7652356b8a112bf2 Mon Sep 17 00:00:00 2001 +From: Oscar Lesta +Date: Fri, 9 Aug 2024 15:45:45 -0300 +Subject: Fix test_compileall by skipping tests that need hardlink support. + +Just a quick fix. Python 3.13 has "@os_helper.skip_unless_hardlink" +which reads better (albeit we need to patch a bit too). + +diff --git a/Lib/test/test_compileall.py b/Lib/test/test_compileall.py +index 5832f84..2e736db 100644 +--- a/Lib/test/test_compileall.py ++++ b/Lib/test/test_compileall.py +@@ -921,6 +921,7 @@ class CommandLineTestsBase: + # only for more than one optimization level + self.assertRunNotOK(self.directory, "-o 1", "--hardlink-dupes") + ++ @unittest.skipUnless(sys.platform[:5] != 'haiku', 'requires hardlink support') + def test_hardlink(self): + # 'a = 0' code produces the same bytecode for the 3 optimization + # levels. All three .pyc files must have the same inode (hardlinks). +@@ -958,7 +959,7 @@ class CommandLineTestsNoSourceEpoch(CommandLineTestsBase, + + + +-@unittest.skipUnless(hasattr(os, 'link'), 'requires os.link') ++@unittest.skipUnless(hasattr(os, 'link') and sys.platform[:5] != 'haiku', 'requires os.link') + class HardlinkDedupTestsBase: + # Test hardlink_dupes parameter of compileall.compile_dir() + +-- +2.45.2 + diff --git a/dev-lang/python/python3.12-3.12.4.recipe b/dev-lang/python/python3.12-3.12.6.recipe similarity index 71% rename from dev-lang/python/python3.12-3.12.4.recipe rename to dev-lang/python/python3.12-3.12.6.recipe index eaec515d2..4e8ee5896 100644 --- a/dev-lang/python/python3.12-3.12.4.recipe +++ b/dev-lang/python/python3.12-3.12.6.recipe @@ -11,9 +11,9 @@ OSI-approved open source license." HOMEPAGE="https://www.python.org" LICENSE="Python" COPYRIGHT="1990-2024 Python Software Foundation" -REVISION="2" +REVISION="1" SOURCE_URI="https://www.python.org/ftp/python/$portVersion/Python-${portVersion}.tar.xz" -CHECKSUM_SHA256="f6d419a6d8743ab26700801b4908d26d97e8b986e14f95de31b32de2b0e79554" +CHECKSUM_SHA256="1999658298cf2fb837dffed8ff3c033ef0c98ef20cf73c5d5f66bed5ab89697c" SOURCE_DIR="Python-$portVersion" pyShortVer="${portVersion%.*}" @@ -36,20 +36,39 @@ GLOBAL_WRITABLE_FILES=" non-packaged/lib/python$pyShortVer/site-packages directory keep-old " +# [RECIPE OPTIONS]>>> + +# If this is not intended to be the "default" Python version, set to "false", so "make altinstall" +# is used, and only version-suffixed commands are used in PROVIDES. +installAsDefaultPython=false + +# Set to "true" if we should build the "tkinter" module. +# Disabled for now, as tkinter deadlocks on Haiku. Try again when tk drops undroidwish for xlibe. +enableTkinter=false + +# Set to "true" to package all the tests into a separate "_tests" package (around 30 MB in size). +# Tests are discarded if set to "false". +packageTests=false + +# Set to "false" for faster local/test builds. Around 4 to 5 times faster that way. +optimizedBuild=true + +# Run all tests by default. Set to "true" to make "hp --test" only run then known failing tests. +runOnlyKnownFailingTests=false + +# <<<[RECIPE OPTIONS] + PROVIDES=" python$pyShortVer$secondaryArchSuffix = $pyVersionCompat cmd:2to3_$pyShortVer = $pyVersionCompat - cmd:idle$pyShortVer = $pyVersionCompat cmd:pydoc$pyShortVer = $pyVersionCompat cmd:python$pyShortVer = $pyVersionCompat cmd:python${pyShortVer}_config = $pyVersionCompat - cmd:pyvenv_$pyShortVer = $pyVersionCompat devel:libpython$pyShortVer$secondaryArchSuffix = 1.0 lib:libpython$pyShortVer$secondaryArchSuffix = 1.0 " REQUIRES=" haiku$secondaryArchSuffix - timezone_data cmd:file lib:libbz2$secondaryArchSuffix lib:libedit$secondaryArchSuffix @@ -57,7 +76,7 @@ REQUIRES=" lib:libffi$secondaryArchSuffix lib:libintl$secondaryArchSuffix lib:liblzma$secondaryArchSuffix - lib:libncurses$secondaryArchSuffix + lib:libncursesw$secondaryArchSuffix lib:libsqlite3$secondaryArchSuffix lib:libssl$secondaryArchSuffix lib:libz$secondaryArchSuffix @@ -69,11 +88,9 @@ BUILD_REQUIRES=" devel:libexpat$secondaryArchSuffix devel:libffi$secondaryArchSuffix devel:liblzma$secondaryArchSuffix - devel:libncurses$secondaryArchSuffix + devel:libncursesw$secondaryArchSuffix devel:libsqlite3$secondaryArchSuffix devel:libssl$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=" @@ -86,18 +103,34 @@ BUILD_PREREQUIRES=" cmd:libtoolize$secondaryArchSuffix cmd:make cmd:pkg_config$secondaryArchSuffix -# cmd:python3 >= 3.10 # because using `export PYTHON_FOR_REGEN="./python"` is just unreliable. +# cmd:python3 >= 3.10 # needed if PYTHON_FOR_REGEN is invoked for any reason. " -# 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 $installAsDefaultPython; then + PROVIDES+=" + cmd:2to3 = $portVersion compat >= $pyShortVer + cmd:python3 = $portVersion compat >= $pyShortVer + cmd:pydoc3 = $portVersion compat >= $pyShortVer + cmd:python3_config = $portVersion compat >= $pyShortVer + " +fi -# If set to "yes", the resulting "_tests" package is around 30 MB in size. -packageTests="no" -if [ "$packageTests" = "yes" ]; then +if $enableTkinter; then + PROVIDES+=" + cmd:idle$pyShortVer = $pyVersionCompat + " + if $installAsDefaultPython; then + PROVIDES+=" + cmd:idle3 = $portVersion compat >= $pyShortVer + " + fi + BUILD_REQUIRES+=" + devel:libtclstub8.6$secondaryArchSuffix + devel:libtk8.6$secondaryArchSuffix + " +fi + +if $packageTests; then PROVIDES_tests=" python$pyShortVer${secondaryArchSuffix}_tests = $portVersion " @@ -114,39 +147,47 @@ BUILD() # "compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just # for debug/optimization stuff. BASECFLAGS is for flags that are required # just to get things to compile and link." - export BASECFLAGS="-pipe -D_BSD_SOURCE" - # Not exporting OPT ends up with "-g -fwrapv -O3 -Wall" being used, - # and using OPT="" means the build ends up being "-O0". - export OPT="-fwrapv -O3 -Wall" + # If not provided, the Makefile ends up with: + # BASECFLAGS= -fno-strict-overflow -Wsign-compare + # OPT= -DNDEBUG -g -O3 -Wall + # -NDEBUG gets added by ./configure unless "--with-assertions" is used. + + export BASECFLAGS="-pipe -D_BSD_SOURCE" + export OPT=" -Wall" # Unless cmd:python3 >= 3.10 is available (by being listed on BUILD_PREREQUIRES), we'll # get "python3: command not found" when the build tries to generate some files. - # We can force the use of the "./python" built on the chroot instead: - # - # export PYTHON_FOR_REGEN="./python" - # - # But using that ocassionally fails with: - # "runtime_loader: Cannot open file libpython3.nn.so.1.0 (needed by /sources/Python-3.nn.n/python): No such file or directory" - # Perhaps this alternative might work?: # + # If attempting to bootstrap, we can try forcing the use of the "./python" built on the + # chroot instead: # export PYTHON_FOR_REGEN="LD_PRELOAD=./libpython3.nn.so.1.0 ./python" + if $optimizedBuild; then + export OPT+=" -O3" + maybeEnableOptimizations="--enable-optimizations" + else + export OPT+=" -O0" + maybeEnableOptimizations= + fi + runConfigure --omit-dirs binDir,includeDir ./configure \ --bindir=$commandBinDir \ --includedir=$developDir/headers \ - --enable-optimizations \ + $maybeEnableOptimizations \ --enable-shared \ --with-ensurepip=no \ --with-readline=editline \ --with-system-expat \ --with-tzpath=$dataDir/zoneinfo \ --without-static-libpython + # --disable-test-modules interferes with the PGO tests. don't use it. + # # --with-lto # Issues with enabling this flag: - # - Is too CPU intensive (at least 3 times slower build). - # - Seems libpython3.12.so.1.0 is left with debug input in it (30% final package size increase). - # - No noticeable speed difference, at least on the "pystone.py" syntetic benchmark. - # ToDo: CFLAGS_NODIST and LDFLAGS_NODIST end up with "-g" in them if using "--with-lto". Investigate. + # - Is too CPU intensive (at least 2.5x slower build times). + # - 30% final package size increase, unless "-g" is removed from 'LTOFLAGS="$LTOFLAGS -g"' + # on "configure.ac". + # but resulting Python is about %5 faster, at least on the "pystone.py" syntetic benchmark. # Uncomment when doing repeated builds (for testing different flags/options). # echo "[.recipe] Cleaning before rebuild:" && make clean && rm -f python @@ -162,18 +203,33 @@ BUILD() # "Parser/parser.c:38718:1: error: corrupted profile info: invalid time profile" # # Not using multiple jobs for make solves both the warnings and the possible error. - # make $jobArgs - make -j 1 + + if $optimizedBuild; then + make -j 1 + else + make $jobArgs + fi } INSTALL() { - # altinstall avoids clobbering $prefix/bin/{2to3,idle3,pydoc3,python3,python3-config} - make altinstall + if $installAsDefaultPython; then + make install + else + # altinstall avoids clobbering $prefix/bin/{idle3,pydoc3,python3,python3-config} + make altinstall + fi - # Remove this one for "make altinstall" Python versions on Haiku. rm $libDir/libpython3.so + # No point in having this if we don't have a working tkinter. + if ! $enableTkinter; then + rm $prefix/bin/idle$pyShortVer + if $installAsDefaultPython; then + rm -f $prefix/bin/idle3 + fi + fi + 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/ @@ -192,7 +248,7 @@ INSTALL() mkdir -p $prefix/non-packaged/lib/python$pyShortVer mv $prefix/lib/python$pyShortVer/site-packages $prefix/non-packaged/lib/python$pyShortVer/ - if [ "$packageTests" = "yes" ]; then + if $packageTests; then packageEntries tests \ $prefix/lib/python$pyShortVer/idlelib/idle_test \ $prefix/lib/python$pyShortVer/test @@ -227,11 +283,15 @@ INSTALL() # 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 tests that way can cause some tests 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, results on hrev56578+96 (64 bits VBox): -#Total duration: 12 min 39 sec -#Total tests: run=36,147 failures=254 skipped=1,798 -#Total test files: run=442/424 failed=23 skipped=33 resource_denied=6 rerun=24 +# For reference, results on hrev57937+113 (64 bits VBox): +# Total duration: 13 min 9 sec +# Total tests: run=33,883 failures=222 skipped=971 +# Total test files: run=434/424 failed=15 skipped=32 resource_denied=6 rerun=16 TEST() { # Remove tests data left-overs, if any: @@ -352,45 +412,42 @@ TEST() # 3.12.4 hang at least once on beta4. -x test_importlib + + # 3.12.6, on beta5 + -x test_readline # hangs when running tests in parallel (or as part of the suite, at least). ) local tests_that_fail=( test_c_locale_coercion - test_compileall test_datetime test_fcntl - test_fork1 - test_genericpath - test_import - test_json + test_genericpath # os.path.getatime() should return an int. + test_json # either takes almost 5 minutes, or fails right away!? + test_kqueue test_pathlib test_popen - test_pty test_re - test_readline + test_readline # hangs sometimes. test_shutil - test_site - test_support - test_sysconfig - test_tarfile + test_tarfile # os.path.getmtime() should return an int. Also, path.stat().st_mtime and pathlib.Path(TEMPDIR).stat().st_mtime seems to be using different scales: 1723.215266 vs 1723215266.0319815 test_termios test_time test_tools - test_utf8_mode - test_zipfile ) local -x LOGNAME=buildbot # this skips tests_tools/test_freeze, copied from Gentoo's ebuild - # 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[*]}" + if $runOnlyKnownFailingTests; then + make $jobArgs test EXTRATESTOPTS="${test_options[*]} ${tests_that_fail[*]}" + else + # Runs the full test suite (minus the tests that we explicitly exclude). + make $jobArgs test EXTRATESTOPTS="${test_options[*]} ${tests_to_exclude[*]}" + fi # 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. # # If you find some strange "æ" suffix on temp dirnames, ej: - # "cwd: /sources/Python-3.10.12/build/test_python_10324æ" + # "cwd: /sources/Python-3.nn.nn/build/test_python_10324æ" # That's due to usages of os_helper.FS_NONASCII. }