# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-murmurhash
pkgver=1.0.11
pkgrel=0
pkgdesc="Cython bindings for MurmurHash2"
url="https://github.com/explosion/murmurhash"
arch="all"
license="MIT"
makedepends="
	cython
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="py3-pytest py3-mmh3"
subpackages="$pkgname-doc $pkgname-pyc"
source="murmurhash-$pkgver.tar.gz::https://github.com/explosion/murmurhash/archive/refs/tags/release-v$pkgver.tar.gz"
builddir="$srcdir/murmurhash-release-v$pkgver"

# results differ on big endian:
# https://github.com/explosion/murmurhash/issues/26
case "$CARCH" in
s390x) options="!check" ;;
esac

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 build/
}

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

	rm -r "$pkgdir"/usr/lib/python3*/site-packages/murmurhash/tests/

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

sha512sums="
f5d5217028c4c26fec947d3dc3bbbe0d8892efc5eaed5dc4b80d2c177fbdf53bc04a1f63dea6b46103ed44ff7883ec940488749a18ac46b311627349b452cdac  murmurhash-1.0.11.tar.gz
"
