# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-nh3
pkgver=0.2.18
pkgrel=0
pkgdesc="Python bindings to the ammonia HTML sanitization library"
url="https://github.com/messense/nh3"
arch="all"
license="MIT"
makedepends="
	cargo
	py3-gpep517
	py3-maturin
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://pypi.org/packages/source/n/nh3/nh3-$pkgver.tar.gz"
options="net" # Required to download Rust crates
builddir="$srcdir/nh3-$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
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

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

sha512sums="
1579ece4642911bf760ee3747ea44b7001ee7f70da65940b548fc2b30a20fee5d5c924d7d44ee73fcf4b3642591cb7085b3da0088b91a6752abfde53c798c275  nh3-0.2.18.tar.gz
"
