*_python*: clean up around commands suffixes. Drop Python3.9 support. (#12591)

Plus general recipe clean ups, while we're at it.

----

Tested locally only for mutagen. Will fix if something breaks.

`requests_python39` will pop up in in the reports due to missing `chardet_python39`.
Nothing requires `requests_python39` on tree, so will remove that at some point.
This commit is contained in:
OscarL
2025-07-14 20:48:47 -03:00
committed by GitHub
parent e8a2689159
commit 0922e64579
4 changed files with 175 additions and 115 deletions

View File

@@ -3,7 +3,7 @@ DESCRIPTION="Python module for character encoding auto-detection."
HOMEPAGE="https://github.com/chardet/chardet"
COPYRIGHT="2011-2022 Mark Pilgrim, Dan Blanchard"
LICENSE="GNU LGPL v2.1"
REVISION="5"
REVISION="6"
SOURCE_URI="https://pypi.io/packages/source/${portName:0:1}/$portName/${portName}-$portVersion.tar.gz"
CHECKSUM_SHA256="0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"
@@ -20,34 +20,41 @@ BUILD_REQUIRES="
haiku_devel
"
PYTHON_PACKAGES=(python39 python310)
PYTHON_VERSIONS=(3.9 3.10)
commandSuffixes=(3.8 "" 3.10)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
commandSuffix=${commandSuffixes[$i]}
eval "PROVIDES_${pythonPackage}=\"\
${portName}_$pythonPackage = $portVersion\n\
cmd:chardetect$commandSuffix = $portVersion\n\
\"; \
REQUIRES_$pythonPackage=\"\
haiku\n\
cmd:python$pythonVersion\
\""
BUILD_REQUIRES="$BUILD_REQUIRES
setuptools_$pythonPackage"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
cmd:python$pythonVersion"
PYTHON_VERSIONS=(3.10)
defaultVersion=3.10
for pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_${pythonPackage}=\"
${portName}_$pythonPackage = $portVersion
cmd:chardetect_$pythonVersion = $portVersion
\""
# Provide non-suffixed cmd only for the default Python version
if [ $pythonVersion = $defaultVersion ]; then
eval "PROVIDES_$pythonPackage+=\"
cmd:chardetect = $portVersion
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku
cmd:python$pythonVersion
\""
BUILD_REQUIRES+="
setuptools_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
done
INSTALL()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
commandSuffix=${commandSuffixes[$i]}
for pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
python=python$pythonVersion
installLocation=$prefix/lib/$python/vendor-packages/
@@ -59,13 +66,19 @@ INSTALL()
$python setup.py build install \
--root=/ --prefix=$prefix
if [ "$pythonVersion" = "$commandSuffix" ]; then
# Version suffix all the scripts
for f in $binDir/*; do
mv $f $f-$pythonVersion
done
# And provide suffix-less symlinks for the default version
if [ $pythonVersion = $defaultVersion ]; then
for f in $binDir/*; do
mv $f ${f}$commandSuffix
ln -sr $f ${f%-$pythonVersion}
done
fi
packageEntries $pythonPackage \
packageEntries $pythonPackage \
$prefix/lib/python* \
$binDir
done