pyaes: drop support for Python 2.7/3.7, add it for 3.9/3.10. (#8249)

Added TESTS(). They all pass.
This commit is contained in:
OscarL
2023-04-03 07:16:21 -03:00
committed by GitHub
parent be38292d45
commit 68f9db6609

View File

@@ -4,7 +4,7 @@ and the common modes of operation (CBC, CFB, CTR, ECB and OFB)."
HOMEPAGE="https://pypi.python.org/pypi/pip"
COPYRIGHT="2014 Richard Moore"
LICENSE="MIT"
REVISION="1"
REVISION="2"
SOURCE_URI="https://pypi.org/packages/source/p/pyaes/pyaes-$portVersion.tar.gz"
CHECKSUM_SHA256="02c1b1405c38d3c370b085fb952dd8bea3fadcee6411ad99f312cc129c536d8f"
@@ -21,25 +21,42 @@ BUILD_REQUIRES="
haiku_devel
"
PYTHON_PACKAGES=(python python3)
PYTHON_VERSIONS=(2.7 3.7)
PYTHON_PACKAGES=(python39 python310)
PYTHON_VERSIONS=(3.9 3.10)
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_${pythonPackage}=\"\
${portName}_$pythonPackage = $portVersion\n\
\"; \
REQUIRES_$pythonPackage=\"\
haiku\n\
cmd:python$pythonVersion\n\
setuptools_$pythonPackage\n\
\""
BUILD_REQUIRES="$BUILD_REQUIRES
setuptools_$pythonPackage"
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
cmd:python$pythonVersion"
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_${pythonPackage}=\"
${portName}_$pythonPackage = $portVersion
\""
eval "REQUIRES_$pythonPackage=\"
haiku
cmd:python$pythonVersion
setuptools_$pythonPackage
\""
BUILD_REQUIRES+="
setuptools_$pythonPackage
"
BUILD_PREREQUIRES+="
cmd:python$pythonVersion
"
# Tests Needs "Crypto", but PyCrypto is deprecated, so use a replacement.
# The "if" is necessary due to the recipe being "any" and not having a
# non _x86 package on 32 bits.
if [ $targetArchitecture = x86_gcc2 ]; then
TEST_REQUIRES+="
pycryptodome_x86_$pythonPackage
"
else
TEST_REQUIRES+="
pycryptodome_$pythonPackage
"
fi
done
INSTALL()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
@@ -49,8 +66,10 @@ INSTALL()
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
@@ -58,3 +77,21 @@ INSTALL()
$prefix/lib/python*
done
}
TEST()
{
cd tests
# Make sure the tests can find the local "pyaes" module
export PYTHONPATH="../":$PYTHONPATH
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
python=python$pythonVersion
for f in *.py; do
$python $f
done
done
}