1SUMMARY="A Python testing framework"
2DESCRIPTION="The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries."
3HOMEPAGE="https://pytest.org"
4COPYRIGHT="2004 Holger Krekel and others."
5LICENSE="MIT"
6REVISION="2"
7SOURCE_URI="https://pypi.io/packages/source/p/pytest/pytest-$portVersion.tar.gz"
8CHECKSUM_SHA256="434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3"
9
10ARCHITECTURES="any"
11
12PROVIDES="
13	$portName=$portVersion
14	"
15REQUIRES="
16	haiku
17	"
18
19BUILD_REQUIRES="
20	haiku_devel
21	"
22
23PYTHON_PACKAGES=(python39 python310)
24PYTHON_VERSIONS=(3.9 3.10)
25defaultVersion=3.9
26for i in "${!PYTHON_PACKAGES[@]}"; do
27	pythonPackage=${PYTHON_PACKAGES[i]}
28	pythonVersion=${PYTHON_VERSIONS[$i]}
29
30	eval "PROVIDES_${pythonPackage}=\"
31		${portName}_$pythonPackage = $portVersion
32		cmd:py.test_$pythonVersion = $portVersion
33		cmd:pytest_$pythonVersion = $portVersion
34		\""
35	# Provide non-suffixed cmd only for the default Python version
36	if [ $pythonVersion = $defaultVersion ]; then
37		eval "PROVIDES_$pythonPackage+=\"
38			cmd:py.test = $portVersion
39			cmd:pytest = $portVersion
40			\""
41	fi
42	eval "REQUIRES_$pythonPackage=\"
43		haiku
44		exceptiongroup_$pythonPackage
45		importlib_metadata_$pythonPackage
46		iniconfig_$pythonPackage
47		packaging_$pythonPackage
48		pluggy_$pythonPackage
49		tomli_$pythonPackage
50		cmd:python$pythonVersion
51		\""
52	BUILD_REQUIRES+="
53		setuptools_scm_$pythonPackage
54		"
55	BUILD_PREREQUIRES+="
56		build_$pythonPackage
57		installer_$pythonPackage
58		wheel_$pythonPackage
59		cmd:python$pythonVersion
60		"
61done
62
63INSTALL()
64{
65	export SETUPTOOLS_SCM_PRETEND_VERSION=$portVersion
66
67	for i in "${!PYTHON_PACKAGES[@]}"; do
68		pythonVersion=${PYTHON_VERSIONS[$i]}
69
70		python=python$pythonVersion
71		$python -m build --wheel --skip-dependency-check --no-isolation
72		$python -m installer -p $prefix dist/*.whl
73
74		# Version suffix all the scripts
75		for f in $binDir/*; do
76			mv $f $f-$pythonVersion
77		done
78
79		# And provide suffix-less symlinks for the default version
80		if [ $pythonVersion = $defaultVersion ]; then
81			for f in $binDir/*; do
82				ln -sr $f ${f%-$pythonVersion}
83			done
84		fi
85
86		packageEntries ${PYTHON_PACKAGES[i]} \
87			$prefix/lib/python* \
88			$binDir
89	done
90}
91