# Maintainer: Struan Robertson <contact@struanrobertson.co.uk>
pkgname=py3-isbnlib
_pkgname=isbnlib
pkgver=3.10.14
pkgrel=0
pkgdesc="Extract, clean, transform, hyphenate and metadata for ISBNs"
url="https://github.com/xlcnd/isbnlib"
arch="noarch"
license="LGPL-3.0-only"
depends="python3"
makedepends="
	py3-setuptools_scm
	py3-gpep517
	py3-wheel
"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/xlcnd/isbnlib/archive/v$pkgver/isbnlib-v$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check" # Tests failing

export SETUPTOOLS_SCM_PRETEND_VERSION="$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --system-site-packages .testenv
	.testenv/bin/python -m installer .dist/*.whl
	.testenv/bin/python -m pytest isbnlib/test
}

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

sha512sums="
15f08c857a089fd08f3b0e7360ecee0637a34c6c3d29a4b1b40d1553115764fd351b1b1cc7a986f606d6f3dbce92623364fd363457362138f36dae7f37d7be04  isbnlib-v3.10.14.tar.gz
"
