# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-mnemonic
pkgver=0.21
pkgrel=0
pkgdesc="Python mnemonic code for generating deterministic keys, BIP39"
url="https://github.com/trezor/python-mnemonic"
arch="noarch"
license="MIT"
makedepends="py3-gpep517 py3-poetry-core"
checkdepends="py3-pytest"
subpackages="$pkgname-doc $pkgname-pyc"
source="mnemonic-$pkgver.tar.gz::https://github.com/trezor/python-mnemonic/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/python-mnemonic-$pkgver"

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

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

sha512sums="
b541052fb48291cf4976fc750d7d502152ac5ef33e203edde9158d768ae826766626ae9979821f3123ea8cf2abec023415e7f8a6dc3fd69d15d9a0570ee3c83c  mnemonic-0.21.tar.gz
"
