Files
haikuports/dev-python/pytest/pytest-7.3.1.recipe
2025-08-04 13:24:15 +00:00

91 lines
2.1 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="4"
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_VERSIONS=(3.10)
defaultVersion=3.10
for pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_$pythonPackage=\"
${portName}_$pythonPackage = $portVersion
cmd:py.test_$pythonVersion = $portVersion
cmd:pytest_$pythonVersion = $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 pythonVersion in ${PYTHON_VERSIONS[@]}; do
pythonPackage=python${pythonVersion//.}
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-$pythonVersion
done
# And provide suffix-less symlinks for the default version
if [ $pythonVersion = $defaultVersion ]; then
for f in $binDir/*; do
ln -sr $f ${f%-$pythonVersion}
done
fi
packageEntries $pythonPackage \
$prefix/lib/python* \
$binDir
done
}