cffi: clean up recipe, drop Python 3.9. (#11708)

On-tree recipes that depend on cffi:

- argon2_cffi_bindings
- bcrypt
- pycares
- pynacl

So we're doing the same on those too in one go.

Also:

- moved all recipes to use build/installer instead of setup.py.
- fixed calling of tests on cffi.
This commit is contained in:
OscarL
2025-02-03 10:42:12 -03:00
committed by GitHub
parent a5e7de042c
commit c50b5fadd6
5 changed files with 175 additions and 164 deletions

View File

@@ -4,7 +4,7 @@ HOMEPAGE="https://cffi.readthedocs.io/
https://pypi.org/project/cffi/"
COPYRIGHT="2012-2021 Armin Rigo, Maciej Fijalkowski"
LICENSE="MIT"
REVISION="3"
REVISION="4"
SOURCE_URI="https://files.pythonhosted.org/packages/source/c/cffi/cffi-$portVersion.tar.gz"
CHECKSUM_SHA256="d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9"
@@ -24,76 +24,77 @@ BUILD_REQUIRES="
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:pkg_config$secondaryArchSuffix
"
PYTHON_PACKAGES=(python39 python310)
PYTHON_VERSIONS=(3.9 3.10)
PYTHON_LIBSUFFIXES+=()
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonLibSuffix=${PYTHON_LIBSUFFIXES[$i]}
eval "PROVIDES_${pythonPackage}=\"\
${portName}_$pythonPackage = $portVersion\
\"; \
REQUIRES_$pythonPackage=\"\
haiku\n\
lib:libffi$secondaryArchSuffix\n\
lib:libpython$pythonVersion$pythonLibSuffix$secondaryArchSuffix\n\
pycparser_$pythonPackage\n\
cmd:python$pythonVersion\
\""
if [ "$targetArchitecture" = "x86_gcc2" ]; then
eval "PROVIDES_${pythonPackage}+=\"\n\
cffi_$pythonPackage = $portVersion\
PYTHON_VERSIONS=(3.10)
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_${pythonPackage}=\"
${portName}_$pythonPackage = $portVersion
\""
fi
BUILD_REQUIRES="$BUILD_REQUIRES
setuptools_$pythonPackage
pycparser_$pythonPackage"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
cmd:python$pythonVersion"
if [ "$targetArchitecture" = x86_gcc2 ]; then
eval "PROVIDES_${pythonPackage}+=\"
cffi_$pythonPackage = $portVersion
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku
pycparser_$pythonPackage
cmd:python$pythonVersion
lib:libffi$secondaryArchSuffix
\""
BUILD_REQUIRES+="
build_$pythonPackage
installer_$pythonPackage
setuptools_$pythonPackage
wheel_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
TEST_REQUIRES="
cffi_$pythonPackage
py_$pythonPackage
pytest_$pythonPackage
"
done
TEST_REQUIRES+="
${portName}_$pythonPackage
py_$pythonPackage
pycparser_$pythonPackage
pytest_$pythonPackage
"
INSTALL()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonPackage=python${pythonVersion//.}
python=python$pythonVersion
installLocation=$prefix/lib/$python/vendor-packages/
export PYTHONPATH=$installLocation:$PYTHONPATH
mkdir -p $installLocation
rm -rf build
$python setup.py build install \
--root=/ --prefix=$prefix
packageEntries $pythonPackage \
packageEntries $pythonPackage \
$prefix/lib/python*
done
}
# Results for reference:
# 6 failed, 1913 passed, 120 skipped, 4 xfailed, 567 warnings in 1034.70s (0:17:14)
# failures are harmless, due to tests expecting dl/libm/libc names instead of what Haiku provides.
TEST()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
cd "$sourceDir"-$pythonPackage
python=python$pythonVersion
echo import cffi | $python
$python setup.py test
cd testing
$python support.py
for i in "${!PYTHON_VERSIONS[@]}"; do
py.test c/ testing/
done
}