# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-param
pkgver=2.1.1
pkgrel=0
pkgdesc="Make your Python code clearer and more reliable by declaring Parameters"
url="https://github.com/holoviz/param"
arch="noarch"
license="BSD-3-Clause"
depends="python3"
makedepends="py3-gpep517 py3-hatchling py3-hatch-vcs py3-wheel"
checkdepends="py3-pytest-asyncio py3-pytest-cov py3-flake8"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/holoviz/param/archive/v$pkgver/param-$pkgver.tar.gz"
builddir="$srcdir/param-$pkgver"

case "$CARCH" in
# several test fails on two architectures | skip for now
ppc64le | riscv64) options="$options !check" ;;
esac

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -k 'not testreactive.py' --ignore=tests/testjsonserialization.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	install -Dm644 ./*.md -t "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
a28562e08ed332f23c4d56a81633bd5afa8223aa74ccbc93bca39b4d07f4d50b4667a45a9cad800a6e2913e5d9d2ed2bad550202da87858f0ecf286bf9d3da46  py3-param-2.1.1.tar.gz
"
