Files
haikuports/dev-lang/python/python3.10-3.10.8.recipe
OscarL 08152db1bc python3.10: bump version to 3.10.8. (#7313)
* python310: bump revision to 3.10.8.

* Use "make altinstall".
* Documented problematic tests, and skipped the ones that hang/stall.
* Enable optimizations.
* Added a note regarding tests that invoke the crash dialog.

Running "hp --test python310" now gives the same results[*] for both
non-optimized, and optimized builds, so let's just enable
optimizations for 3.10.8.

[*] As there's some randomness involved in the test runs, YMMV.

Anecdotal/aditional info:

Building and testing with "--disable-test-modules" might be
considered? Python's docs read:

   "The test package is meant for internal use by Python only."

And that those are used for regression testing mostly. See:
https://docs.python.org/3/library/test.html#module-test

Personal experience: I got more consistent results with that flag
enabled, than witout it. I left it out, trying to avoid hiding
problems (a.k.a.: failing silently. A big NO-NO in QA/QC), and
because I assume that packaging Python counts as "internal use".

* python310: patch tests that need several GB of storage.

They now behave like on Windows or MacOSX, requiring to be enabled
by the use of the "largefile" resource usage flag.

* python3.10: rename package from python310 to python3.10.

This matches the rename of python3 to python3.7, and the similar
change for Python 3.9.

Renamed patchset files to match the recipe naming.

Sorted sections according to the Haikuporter Guidelines.
2022-12-04 16:53:38 +01:00

236 lines
7.8 KiB
Bash

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="6a30ecde59c47048013eb5a658c9b5dec277203d2793667f578df7671f7f03f3"
SOURCE_DIR="Python-$portVersion"
PATCHES="python3.10-$portVersion.patchset"
if [ "$secondaryArchSuffix" = _x86 ] ; then
PATCHES+="
python3.10_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
GLOBAL_WRITABLE_FILES="
non-packaged/lib/python3.10/site-packages directory keep-old
"
PROVIDES="
python3.10$secondaryArchSuffix = $portVersion compat >= 3.10
python310$secondaryArchSuffix = $portVersion compat >= 3.10
cmd:2to3_3.10 = $portVersion compat >= 3.10
cmd:idle3.10 = $portVersion compat >= 3.10
cmd:pydoc3.10 = $portVersion compat >= 3.10
cmd:python3.10 = $portVersion compat >= 3.10
cmd:python3.10_config = $portVersion compat >= 3.10
cmd:pyvenv_3.10 = $portVersion compat >= 3.10
devel:libpython3.10$secondaryArchSuffix = 1.0
lib:libpython3.10$secondaryArchSuffix = 1.0
"
REQUIRES="
haiku$secondaryArchSuffix
cmd:file
lib:libbz2$secondaryArchSuffix
lib:libexpat$secondaryArchSuffix
lib:libffi$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:liblzma$secondaryArchSuffix
lib:libncurses$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libedit$secondaryArchSuffix
lib:libsqlite3$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
REPLACES="
python310$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libbz2$secondaryArchSuffix
devel:libexpat$secondaryArchSuffix
devel:libffi$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libncurses$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libedit$secondaryArchSuffix
devel:libsqlite3$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:pkg_config$secondaryArchSuffix
cmd:make
"
BUILD()
{
export CFLAGS="-D_BSD_SOURCE"
rm -Rf Modules/expat
autoreconf -fi
export OPT=""
runConfigure --omit-dirs binDir,includeDir ./configure \
--enable-shared --enable-optimizations \
--with-ensurepip=no --with-system-ffi --with-readline=editline \
--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()
{
# altinstall avoids clobbering $prefix/bin/{2to3,idle3,pydoc3,python3,python3-config}
make altinstall
rm $libDir/libpython3.so
if [ "$targetArchitecture" = x86_gcc2 ]; then
# On x86_gcc2, move lib-dynload to lib/python3.x/
mv $libDir/python3.10/lib-dynload $prefix/lib/python3.10/
fi
prepareInstalledDevelLibs libpython3.10
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.10/vendor-packages
echo 'This directory contains packaged python modules.' \
>$prefix/lib/python3.10/vendor-packages/README
mkdir -p $prefix/non-packaged/lib/python3.10
mv $prefix/lib/python3.10/site-packages $prefix/non-packaged/lib/python3.10/
# drop testsuite altogether; move to a separate package if needed
cd $prefix/lib/python3.10
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
# 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().
# Otherwise... uncomment these to skip them.
# rm -f test_asyncio/test_futures.py # Crashes: Exception (Segment violation)
# rm -f test_faulthandler.py
# rm -f test_subprocess.py
# rm -f test_threading.py
# 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 ../..
# We could enable/disable certain tests by "resource" type:
# export EXTRATESTOPTS="-u all,-largefile,-audio,-gui,-network,-cpu,-urlfetch,-tzdata"
make $jobArgs test
}