# Contributor: Stefan Wagner <stw@bit-strickerei.de>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-pyphen
pkgver=0.17.2
pkgrel=0
_pkgname=Pyphen
pkgdesc="Python-based dictionary hyphenator library"
url="https://pyphen.org/"
arch="noarch"
license="GPL-2.0-or-later AND LGPL-2.1-or-later AND MPL-1.1"
makedepends="py3-flit-core py3-gpep517"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$_pkgname-$pkgver.tar.gz::https://github.com/Kozea/Pyphen/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-pyphen" # Backwards compatibility
provides="py-pyphen=$pkgver-r$pkgrel" # Backwards compatibility

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="
870deec4cd459060f4a8c6e61248b7813a9820cd98cf7d631461d675860f116485ed9ed3404a3ef0dafb6e6f44c162ade2791928ec5f368556cc6d2ff3c89432  Pyphen-0.17.2.tar.gz
"
