python3.10: fix a 'ctypes' bug I introduced on the 3.10.14 patchset. (#10783)

Also:
- consolidate recipe 'options' near the top.
- remove pyvenv from provides (removed on Python 3.8).
This commit is contained in:
OscarL
2024-08-03 06:14:39 -03:00
committed by GitHub
parent cbc266f578
commit ca1fccee49
2 changed files with 111 additions and 44 deletions

View File

@@ -11,7 +11,7 @@ OSI-approved open source license."
HOMEPAGE="https://www.python.org"
LICENSE="Python"
COPYRIGHT="1990-2024 Python Software Foundation"
REVISION="2"
REVISION="3"
SOURCE_URI="https://www.python.org/ftp/python/$portVersion/Python-$portVersion.tar.xz"
CHECKSUM_SHA256="9c50481faa8c2832329ba0fc8868d0a606a680fc4f60ec48d26ce8e076751fda"
SOURCE_DIR="Python-$portVersion"
@@ -36,21 +36,36 @@ 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=true
# 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
cmd:2to3 = $portVersion compat >= $pyShortVer
cmd:idle3 = $portVersion compat >= $pyShortVer
cmd:python3 = $portVersion compat >= $pyShortVer
cmd:pydoc3 = $portVersion compat >= $pyShortVer
cmd:python3_config = $portVersion compat >= $pyShortVer
"
REQUIRES="
haiku$secondaryArchSuffix
@@ -62,7 +77,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
@@ -77,11 +92,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="
@@ -96,9 +109,31 @@ 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
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 $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
"
@@ -116,16 +151,27 @@ 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= -Wno-unused-result -Wsign-compare
# OPT= -DNDEBUG -g -fwrapv -O3 -Wall
# -NDEBUG gets added by ./configure unless "--with-assertions" is used.
export BASECFLAGS="-pipe -D_BSD_SOURCE"
export OPT="-fwrapv -Wall" # remove "-g" until we use "defineDebugInfoPackage".
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 \
@@ -142,10 +188,23 @@ BUILD()
INSTALL()
{
make install
if $installAsDefaultPython; then
make install
else
# altinstall avoids clobbering $prefix/bin/{idle3,pydoc3,python3,python3-config}
make altinstall
fi
rm $libDir/libpython3.so
# No point in having this if we don't have a working tkinter.
if ! $enableTkinter; then
rm $binDir/idle$pyShortVer
if $installAsDefaultPython; then
rm -f $binDir/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/
@@ -164,7 +223,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
@@ -201,7 +260,7 @@ INSTALL()
#
# > 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
# 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.
@@ -209,7 +268,7 @@ INSTALL()
# 345 tests OK. 23 tests failed. 28 tests skipped.
TEST()
{
# Remove tests data left-overs, if any
# Remove tests data left-overs, if any:
# rm -f -r /boot/system/cache/tmp/
# rm -f -d -r build/test_python*
make $jobArgs test EXTRATESTOPTS="--cleanup"
@@ -338,10 +397,12 @@ TEST()
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.