# Contributor: Noel Kuntze <noel.kuntze@thermi.consulting>
# Maintainer: Noel Kuntze <noel.kuntze@thermi.consulting>
pkgname=py3-cerberus
pkgver=1.3.5
pkgrel=1
pkgdesc="Lightweight, extensible data validation library for Python"
url="https://python-cerberus.org/"
license="ISC"
arch="noarch"
depends="python3 py3-setuptools"
makedepends="py3-gpep517 py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/pyeve/cerberus/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/cerberus-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest -v cerberus/tests
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
	# Don't package the tests or benchmarks
	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/cerberus/tests
	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/cerberus/benchmarks
}

sha512sums="
eaa91f229a009770a1750a51e82c34f06dffeebca7af7cafd5ba3a8529502326dd20af1ed7a60fd5e5ed28edb4b974712b1493aa1e330097a8e36ad70c5e4f23  py3-cerberus-1.3.5.tar.gz
"
