# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-h3
pkgver=3.7.6
_h3_pkgver=3.7.2
pkgrel=1
pkgdesc="Python bindings for H3, a hierarchical hexagonal geospatial indexing system "
url="https://github.com/uber/h3-py"
arch="all"
license="Apache-2.0"
depends="py3-numpy"
makedepends="
	cmake
	cython
	py3-gpep517
	py3-scikit-build
	py3-wheel
	python3-dev
	samurai
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/uber/h3-py/archive/refs/tags/v$pkgver.tar.gz
	h3-$_h3_pkgver.tar.gz::https://github.com/uber/h3/archive/refs/tags/v$_h3_pkgver.tar.gz
	"
builddir="$srcdir/h3-py-$pkgver"

prepare() {
	default_prepare

	rmdir "$builddir"/src/h3lib
	mv "$srcdir/h3-$_h3_pkgver" "$builddir"/src/h3lib
}

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="
f070bb3b18efed8ff36600d493a24a6e4f7a9464caae9e28e570793df1b2329d930302e152870e366a646eb0b3a9b023e99d02114933eac777c1597297b11b9f  py3-h3-3.7.6.tar.gz
fd13623d60dd3be2133f489bbd85494cb3e514f582db47ad708d940139893117fefc34a294ef28eb5fd9156d3cfd584702d0af75e6227c780dc0a8e861f2ad92  h3-3.7.2.tar.gz
"
