maintainer="Michał Polański <michal@polanski.me>"
pkgname=py3-zstandard
pkgver=0.23.0
pkgrel=1
pkgdesc="Python bindings to the Zstandard (zstd) compression library"
url="https://github.com/indygreg/python-zstandard"
license="BSD-3-Clause"
arch="all"
# use bundled zstd, due to the system zstd may not match the actually used
# headers.
# https://github.com/indygreg/python-zstandard/issues/48#issuecomment-2032474718
makedepends="python3-dev py3-gpep517 py3-setuptools py3-wheel py3-cffi"
checkdepends="py3-hypothesis"
subpackages="$pkgname-pyc"
source="https://github.com/indygreg/python-zstandard/archive/$pkgver/py3-zstandard-$pkgver.tar.gz"
builddir="$srcdir/python-zstandard-$pkgver"

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

check() {
	mv zstandard backup
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m unittest -v tests/*.py
	mv backup zstandard
}

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

sha512sums="
06d799f8c5e89e5cc2f5b8ff100aeb3c3ff938757ce39852affb075487f65406d7d3f6d611b1864ec025fff86a51bf15b80c8af6260beda050b4fef5b7edd206  py3-zstandard-0.23.0.tar.gz
"
