python3.9: update to version 3.9.17 (#8847)

* Use BASEFLAGS instead of CFLAGS, and set OPT to something better than "".
  This seems to finally make "--enable-optimizations" do some speedup, so
  lets use it for 3.9 too now.
* "backported" the 3.10 patch for "largefile" flag in tests, and also the
  entire TEST() function from the 3.10.12 recipe, as it makes possible to
  run `hp --test python3.9` without hanging (assuming Debugger is set to
  kill).
This commit is contained in:
OscarL
2023-06-11 09:02:33 -03:00
committed by GitHub
parent b9bf34dcaf
commit 182e1d8b01
4 changed files with 322 additions and 164 deletions

View File

@@ -1,4 +1,4 @@
From 0ad4d86cd6bad85d09487b9f9def1e5ae8cd24af Mon Sep 17 00:00:00 2001
From 43c073e23a07c104fbd177ce6e34b918033b7f66 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 10 Apr 2014 16:03:33 +0000
Subject: initial Haiku patch
@@ -561,17 +561,17 @@ index 0bec170..3b862fa 100644
2.37.3
From f343605ee8c189698d5ec51d32006a7794f169e3 Mon Sep 17 00:00:00 2001
From b599abff2521708a1ff796319d1d2bb32526e4bd Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
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 4effc1d..a320f09 100644
index 8579d3f..e6abe57 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1809,6 +1809,8 @@ class Popen(object):
@@ -1825,6 +1825,8 @@ class Popen(object):
SubprocessError)
if issubclass(child_exception_type, OSError) and hex_errno:
errno_num = int(hex_errno, 16)
@@ -599,7 +599,7 @@ index d64e0a1..0885a30 100644
2.37.3
From a6265bb8ca1131a02965f6967ff01863baadaf19 Mon Sep 17 00:00:00 2001
From 820dcebc11a4405cb892d42b7daff32cf3f805ad Mon Sep 17 00:00:00 2001
From: Philippe Houdoin <philippe.houdoin@gmail.com>
Date: Wed, 24 May 2017 11:09:43 +0000
Subject: Implement CTypes's find_library for Haiku
@@ -683,7 +683,7 @@ index 0c2510e..2b4f04c 100644
2.37.3
From f0216e9fc2bbc0715c342362d8235d6fd697d210 Mon Sep 17 00:00:00 2001
From 6c608a84f82fdd11df68f5d7fe9dd3aefe2a73b3 Mon Sep 17 00:00:00 2001
From: Philipp Wolfer <phil@parolu.io>
Date: Mon, 23 Sep 2019 09:14:58 +0200
Subject: webbrowser: Support for default browsers on Haiku
@@ -709,7 +709,7 @@ index 6023c1e..8359531 100755
2.37.3
From d23b79b7f98ea25ff7271a2b39d9b79248266636 Mon Sep 17 00:00:00 2001
From 4f88341b84dd3b9745bbcb25b1e87ce6f2a5483b Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 4 Oct 2019 22:02:35 +0200
Subject: since 3.8, don't reinit locks on fork.
@@ -732,7 +732,7 @@ index 1ab35a8..c6b54e4 100644
2.37.3
From 96d894b820111705c3dbbca1e7d7a673f6fc9d26 Mon Sep 17 00:00:00 2001
From cb713611e36ca2764be44ced4896597fa45d2b16 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 15 May 2020 15:20:57 +0200
Subject: handle errors returned by internal_connect()
@@ -765,7 +765,7 @@ index b29283e..7af682d 100644
2.37.3
From 9bd5156b56b7abd7d85382482e0cdb2b514f5bb6 Mon Sep 17 00:00:00 2001
From a308b229f1478b10482539058ad5fed4eb084147 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 19 Oct 2020 18:03:09 +0200
Subject: ttyname_r can use MAXPATHLEN
@@ -795,7 +795,7 @@ index bf4e648..c8850d6 100644
2.37.3
From f5ab2ba2fbdf4f3b56a868452ef3733b888c6b76 Mon Sep 17 00:00:00 2001
From b83d3ac655d73f9d1d6437e3b67a52c2225eb3f2 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Mon, 23 May 2022 08:45:31 +0200
Subject: Fix search paths for tcl/tk
@@ -825,7 +825,60 @@ index 2c7f344..8905063 100644
2.37.3
From cd0484017d94caa28766a48b1b3aa5db37459574 Mon Sep 17 00:00:00 2001
From e73d5eac4396ca3ede2fe324808d94a993e3d127 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Fri, 21 Oct 2022 19:58:50 -0300
Subject: Lib/test: require the "largefile" usage flag for I/O heavy tests.
The same was done for Windows and MacOSX already.
This avoids needing several GBs of storage to run the tests
(unless they "largefile" resource usage flag is enabled).
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index feee861..4f76448 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -594,7 +594,7 @@ class IOTest(unittest.TestCase):
# On Windows and Mac OSX this test consumes large resources; It 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 sys.platform[:3] == 'win' or sys.platform == 'darwin':
+ if sys.platform[:3] == 'win' or sys.platform == 'darwin' or sys.platform == 'haiku1':
support.requires(
'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 a99b4ba..1fb24ce 100644
--- a/Lib/test/test_largefile.py
+++ b/Lib/test/test_largefile.py
@@ -250,7 +250,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.
- if sys.platform[:3] == 'win' or sys.platform == 'darwin':
+ if sys.platform[:3] == 'win' or sys.platform == 'darwin' or sys.platform == 'haiku1':
requires('largefile',
'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 5400f25..421025d 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -805,7 +805,7 @@ class LargeMmapTests(unittest.TestCase):
unlink(TESTFN)
def _make_test_file(self, num_zeroes, tail):
- if sys.platform[:3] == 'win' or sys.platform == 'darwin':
+ if sys.platform[:3] == 'win' or sys.platform == 'darwin' or sys.platform == 'haiku1':
requires('largefile',
'test requires %s bytes and a long time to run' % str(0x180000000))
f = open(TESTFN, 'w+b')
--
2.37.3
From 11d6dae926568a5d460a7f01b5c0da9d60360bad Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 6 Mar 2023 22:51:40 +0100
Subject: sysconfig: add haiku schemes
@@ -884,7 +937,7 @@ index e3f79bf..574220b 100644
2.37.3
From 73fdb04878aabd4a118bb66ef6f9a8046a53195d Mon Sep 17 00:00:00 2001
From b6603db7aaeebbbb2c309f509ba4e74048253316 Mon Sep 17 00:00:00 2001
From: Oscar Lesta <oscar.lesta@gmail.com>
Date: Fri, 10 Mar 2023 19:24:51 -0300
Subject: syncronize both _getuserbase() copies on site.py and sysconfig.py.

View File

@@ -1,152 +0,0 @@
SUMMARY="An interpreted, interactive, object-oriented programming language"
DESCRIPTION="Python is a programming language that lets you work more quickly \
and integrate your systems more effectively. You can learn to use Python and \
see almost immediate gains in productivity and lower maintenance costs.
Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java \
and .NET virtual machines.
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-2022 Python Software Foundation"
REVISION="1"
SOURCE_URI="https://www.python.org/ftp/python/$portVersion/Python-$portVersion.tar.xz"
CHECKSUM_SHA256="22dddc099246dd2760665561e8adb7394ea0cc43a72684c6480f9380f7786439"
SOURCE_DIR="Python-$portVersion"
PATCHES="python3.9-$portVersion.patchset"
if [ "$secondaryArchSuffix" = _x86 ] ; then
PATCHES+="
python3.9_x86-$portVersion.patchset
"
fi
ARCHITECTURES="all !x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
PROVIDES="
python3.9$secondaryArchSuffix = $portVersion compat >= 3.9
python39$secondaryArchSuffix = $portVersion compat >= 3.9
cmd:2to3_3.9 = $portVersion compat >= 3.9
cmd:2to3 = $portVersion compat >= 3.9
cmd:idle3.9 = $portVersion compat >= 3.9
cmd:idle3 = $portVersion compat >= 3.9
cmd:pydoc3.9 = $portVersion compat >= 3.9
cmd:pydoc3 = $portVersion compat >= 3.9
cmd:python3.9 = $portVersion compat >= 3.9
cmd:python3 = $portVersion compat >= 3.9
cmd:python3.9_config = $portVersion compat >= 3.9
cmd:python3_config = $portVersion compat >= 3.9
devel:libpython3.9$secondaryArchSuffix = 1.0
lib:libpython3.9$secondaryArchSuffix = 1.0
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:file
lib:libbz2$secondaryArchSuffix
lib:libedit$secondaryArchSuffix
lib:libexpat$secondaryArchSuffix
lib:libffi$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:liblzma$secondaryArchSuffix
lib:libncurses$secondaryArchSuffix
lib:libsqlite3$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libbz2$secondaryArchSuffix
devel:libedit$secondaryArchSuffix
devel:libexpat$secondaryArchSuffix
devel:libffi$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libncurses$secondaryArchSuffix
devel:libsqlite3$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libtclstub8.6$secondaryArchSuffix
devel:libtk8.6$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
autoconf_archive
cmd:aclocal
cmd:autoconf
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:libtoolize$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
GLOBAL_WRITABLE_FILES="
non-packaged/lib/python3.9/site-packages directory keep-old
"
BUILD()
{
export CFLAGS="-D_BSD_SOURCE"
rm -Rf Modules/expat
autoreconf -fi
export OPT=""
runConfigure --omit-dirs binDir,includeDir ./configure \
--enable-shared --without-ensurepip --with-system-ffi \
--with-system-expat --bindir=$commandBinDir --includedir=$developDir/headers
# prevent make from rebuilding stuff that requires python
touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h
rm -f python
make $jobArgs
}
INSTALL()
{
make install
rm $libDir/libpython3.so
if [ "$targetArchitecture" = x86_gcc2 ]; then
# On x86_gcc2, move lib-dynload to lib/python3.x/
mv $libDir/python3.9/lib-dynload $prefix/lib/python3.9/
fi
prepareInstalledDevelLibs libpython3.9
fixPkgconfig
if [ "$targetArchitecture" = x86_gcc2 ]; then
# fix pkgconfig to match configure flags
sed -i -e 's,headers/x86,headers,' $developLibDir/pkgconfig/python*.pc
fi
mkdir -p $prefix/lib/python3.9/vendor-packages
echo 'This directory contains packaged python modules.' \
>$prefix/lib/python3.9/vendor-packages/README
mkdir -p $prefix/non-packaged/lib/python3.9
mv $prefix/lib/python3.9/site-packages $prefix/non-packaged/lib/python3.9/
# drop testsuite altogether; move to a separate package if needed
cd $prefix/lib/python3.9
rm -rf ctypes/test distutils/tests idlelib/idle_test lib2to3/tests \
sqlite3/test test tkinter/test unittest/test
}
TEST()
{
cd Lib/test
rm -f test_asynchat.py # this one stalls, so skip it for now
rm -f test_multiprocessing.py # this one stalls, so skip it for now
cd ../..
make $jobArgs test
}

View File

@@ -0,0 +1,257 @@
SUMMARY="An interpreted, interactive, object-oriented programming language"
DESCRIPTION="Python is a programming language that lets you work more quickly \
and integrate your systems more effectively. You can learn to use Python and \
see almost immediate gains in productivity and lower maintenance costs.
Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java \
and .NET virtual machines.
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-2022 Python Software Foundation"
REVISION="1"
SOURCE_URI="https://www.python.org/ftp/python/$portVersion/Python-$portVersion.tar.xz"
CHECKSUM_SHA256="30ce057c44f283f8ed93606ccbdb8d51dd526bdc4c62cce5e0dc217bfa3e8cee"
SOURCE_DIR="Python-$portVersion"
PATCHES="python3.9-$portVersion.patchset"
if [ "$secondaryArchSuffix" = _x86 ] ; then
PATCHES+="
python3.9_x86-$portVersion.patchset
"
fi
ARCHITECTURES="all !x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="x86"
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
PROVIDES="
python3.9$secondaryArchSuffix = $portVersion compat >= 3.9
python39$secondaryArchSuffix = $portVersion compat >= 3.9
cmd:2to3_3.9 = $portVersion compat >= 3.9
cmd:2to3 = $portVersion compat >= 3.9
cmd:idle3.9 = $portVersion compat >= 3.9
cmd:idle3 = $portVersion compat >= 3.9
cmd:pydoc3.9 = $portVersion compat >= 3.9
cmd:pydoc3 = $portVersion compat >= 3.9
cmd:python3.9 = $portVersion compat >= 3.9
cmd:python3 = $portVersion compat >= 3.9
cmd:python3.9_config = $portVersion compat >= 3.9
cmd:python3_config = $portVersion compat >= 3.9
devel:libpython3.9$secondaryArchSuffix = 1.0
lib:libpython3.9$secondaryArchSuffix = 1.0
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:file
lib:libbz2$secondaryArchSuffix
lib:libedit$secondaryArchSuffix
lib:libexpat$secondaryArchSuffix
lib:libffi$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:liblzma$secondaryArchSuffix
lib:libncurses$secondaryArchSuffix
lib:libsqlite3$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libbz2$secondaryArchSuffix
devel:libedit$secondaryArchSuffix
devel:libexpat$secondaryArchSuffix
devel:libffi$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libncurses$secondaryArchSuffix
devel:libsqlite3$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libtclstub8.6$secondaryArchSuffix
devel:libtk8.6$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
autoconf_archive
cmd:aclocal
cmd:autoconf
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:libtoolize$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
GLOBAL_WRITABLE_FILES="
non-packaged/lib/python3.9/site-packages directory keep-old
"
BUILD()
{
autoreconf -fi
# From ./configure:
# "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="-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"
runConfigure --omit-dirs binDir,includeDir ./configure \
--bindir=$commandBinDir \
--includedir=$developDir/headers \
--enable-optimizations \
--enable-shared \
--with-ensurepip=no \
--with-system-expat \
--with-system-ffi
# "configure: WARNING: --with(out)-system-ffi is ignored on this platform"
# prevent make from rebuilding stuff that requires python
touch Parser/asdl* Python/Python-ast.c Include/Python-ast.h
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
}
INSTALL()
{
make install
rm $libDir/libpython3.so
if [ "$targetArchitecture" = x86_gcc2 ]; then
# On x86_gcc2, move lib-dynload to lib/python3.x/
mv $libDir/python3.9/lib-dynload $prefix/lib/python3.9/
fi
prepareInstalledDevelLibs libpython3.9
fixPkgconfig
if [ "$targetArchitecture" = x86_gcc2 ]; then
# fix pkgconfig to match configure flags
sed -i -e 's,headers/x86,headers,' $developLibDir/pkgconfig/python*.pc
fi
mkdir -p $prefix/lib/python3.9/vendor-packages
echo 'This directory contains packaged python modules.' \
>$prefix/lib/python3.9/vendor-packages/README
mkdir -p $prefix/non-packaged/lib/python3.9
mv $prefix/lib/python3.9/site-packages $prefix/non-packaged/lib/python3.9/
# drop testsuite altogether; move to a separate package if needed
cd $prefix/lib/python3.9
rm -rf ctypes/test distutils/tests idlelib/idle_test lib2to3/tests \
sqlite3/test test tkinter/test unittest/test
}
# Some of the test will crash, invoking the crash dialog, and will hang waiting for
# user's interaction. To avoid that, make sure to configure your system by adding
# the following lines in the file "~/config/settings/system/debug_server/settings":
##---
# executable_actions {
# /sources/Python-$portVersion/python kill
# }
##---
# Replace $portVersion as necessary.
# For some tests that purposefully crash, it would make sense to add support for
# crash-report suppression (as done for other platforms) on "tests/support/__init__,py"'s
# SuppressCrashReport class.
# 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)
TEST()
{
# Remove tests data left-overs, if any
rm -f -r /boot/system/cache/tmp/
rm -f -d -r build/test_python*
cd Lib/test
# distutils is deprecated, and will be removed on 3.12.
rm -f test_distutils.py
# The following tests invoke the crash dialog, and unless your configure
# debug_server default action to "kill" or "report", they will hang waiting for
# user input. See comment above TEST().
rm -f test_asyncio/test_futures.py # Crashes: Exception (Segment violation)
rm -f test_faulthandler.py
rm -f test_subprocess.py # tends to hang.
rm -f test_threading.py # tends to hang.
# Many of the tests hang/stall. We have two options:
#
# 1- Manually remove the problematic test-cases.
# 2- Set a TIMEOUT.
#
# 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)"
# - The time it takes to run the full suite goes from 14 to 30+ minutes,
#
# For Option 2, use: export EXTRATESTOPTS="--timeout=300"
# before calling "make $jobArgs test".
#
# Let's use Option 1, for now at least:
# These hang reliably.
# You might want then to manually restore them on re-runs, use:
# > git checkout -- Lib/test/
rm -f test__xxsubinterpreters.py
rm -f test_asynchat.py
rm -f test_concurrent_futures.py
rm -f test_importlib/test_threaded_import.py
rm -f test_interpreters.py
rm -f test_multiprocessing_fork.py
rm -f test_multiprocessing_forkserver.py
rm -f test_multiprocessing_main_handling.py
rm -f test_multiprocessing_spawn.py
rm -f test_multiprocessing.py
rm -f test_socketserver.py
# "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.
rm -f -r test_asyncio
# rm -f test_asyncio/test_base_events.py
# rm -f test_asyncio/test_buffered_proto.py # Exception on Exception handler.
# rm -f test_asyncio/test_events.py
# rm -f test_asyncio/test_sendfile.py
# rm -f test_asyncio/test_server.py # Exception on Exception handler.
# rm -f test_asyncio/test_sslproto.py # Exception on Exception handler.
# rm -f test_asyncio/test_streams.py
# These not always hang/stall, but they do it enough to warrant skipping for now.
rm -f test_imaplib.py
rm -f test_signal.py
rm -f test_socket.py
rm -f test_ssl.py
rm -f test_urllib2_localnet.py
cd ../..
# These allows to change what resources tests can use:
# export EXTRATESTOPTS="-uall,-largefile,-audio,-gui,-network,-cpu,-urlfetch,-tzdata"
# 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æ"
# That's due to usages of os_helper.FS_NONASCII.
make $jobArgs test
}