# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-mmh3
pkgver=4.0.1
pkgrel=2
pkgdesc="Python wrapper for MurmurHash (MurmurHash3), a set of fast and robust hash functions"
url="https://github.com/hajimes/mmh3"
arch="all"
license="CC0-1.0"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="py3-numpy py3-pytest"
subpackages="$pkgname-doc"
source="mmh3-$pkgver.tar.gz::https://github.com/hajimes/mmh3/archive/v$pkgver.tar.gz"
builddir="$srcdir/mmh3-$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

	# remove C sources erroneously installed into the package
	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/mmh3/

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

sha512sums="
df41c02f8c61782dd8fe0ca6c150e2f421cfb8d81e6d6eb717be38a5907eb7ad8824cb4c8fe9a0b5e8d4cee61c25401385e4fd4a0b2322b22416e1d6cd9df98b  mmh3-4.0.1.tar.gz
"
