# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-libzim
pkgver=3.4.0
pkgrel=1
pkgdesc="Python binding for libzim"
url="https://github.com/openzim/python-libzim"
arch="all"
license="GPL-3.0-or-later"
depends="libzim"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	cython
	python3-dev
	libzim-dev
	"
checkdepends="py3-pytest py3-pytest-cov"
source="py3-libzim-$pkgver.tar.gz::https://github.com/openzim/python-libzim/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/python-libzim-$pkgver"

build() {
	export DONT_DOWNLOAD_LIBZIM=yes
	export USE_SYSTEM_LIBZIM=yes

	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

	# disable one test till cython 3.x will be available
	.testenv/bin/python3 -m pytest \
			-k "not test_creator_additem"
}

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

sha512sums="
c21c3c316483577b6fad516d71dc52955888ce766a8fe148dbb2f29c87a807d4e089ce522a43e643f4f2d5bdf49565bd5b660de947c8b18a26cbf9ab045e29b1  py3-libzim-3.4.0.tar.gz
"
