Files
haikuports/dev-python/pytest/pytest-7.3.1.recipe
2023-06-02 12:47:49 +02:00

91 lines
2.2 KiB
Bash

SUMMARY="A Python testing framework"
DESCRIPTION="The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries."
HOMEPAGE="https://pytest.org"
COPYRIGHT="2004 Holger Krekel and others."
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://pypi.io/packages/source/p/pytest/pytest-$portVersion.tar.gz"
CHECKSUM_SHA256="434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3"
ARCHITECTURES="any"
PROVIDES="
$portName=$portVersion
"
REQUIRES="
haiku
"
BUILD_REQUIRES="
haiku_devel
"
PYTHON_PACKAGES=(python39 python310)
PYTHON_VERSIONS=(3.9 3.10)
defaultVersion=3.9
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
eval "PROVIDES_${pythonPackage}=\"
${portName}_$pythonPackage = $portVersion
cmd:py.test_$pythonVersion.py = $portVersion
cmd:pytest_$pythonVersion.py = $portVersion
\""
# Provide non-suffixed cmd only for the default Python version
if [ $pythonVersion = $defaultVersion ]; then
eval "PROVIDES_$pythonPackage+=\"
cmd:py.test = $portVersion
cmd:pytest = $portVersion
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku
exceptiongroup_$pythonPackage
importlib_metadata_$pythonPackage
iniconfig_$pythonPackage
packaging_$pythonPackage
pluggy_$pythonPackage
tomli_$pythonPackage
cmd:python$pythonVersion
\""
BUILD_REQUIRES+="
setuptools_scm_$pythonPackage
"
BUILD_PREREQUIRES+="
build_$pythonPackage
installer_$pythonPackage
wheel_$pythonPackage
cmd:python$pythonVersion
"
done
INSTALL()
{
export SETUPTOOLS_SCM_PRETEND_VERSION=$portVersion
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
python=python$pythonVersion
$python -m build --wheel --skip-dependency-check --no-isolation
$python -m installer -p $prefix dist/*.whl
# Version suffix all the scripts
for f in $binDir/*; do
mv $f ${f%.py}-${pythonVersion}.py
done
# And provide suffix-less symlinks for the default version
if [ $pythonVersion = $defaultVersion ]; then
for f in $binDir/*; do
ln -sr $f ${f%-$pythonVersion.py}
done
fi
packageEntries ${PYTHON_PACKAGES[i]} \
$prefix/lib/python* \
$binDir
done
}