# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-dunamai
pkgver=1.22.0
pkgrel=0
pkgdesc="Dynamic versioning library and CLI"
url="https://github.com/mtkennerly/dunamai"
arch="noarch"
license="MIT"
depends="py3-packaging"
makedepends="py3-gpep517 py3-poetry-core py3-wheel py3-installer"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/mtkennerly/dunamai/releases/download/v$pkgver/dunamai-$pkgver.tar.gz"
builddir="$srcdir/dunamai-$pkgver"
options="!check" # tests require a git repo

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="
4ace2f4727d3976c662e074b65504ec7f47798008d7b61866db09d670c93c3ab5cb9176e34d19fd812ca6f57324b71504185c4dac9bb2891e7b6d2ca15ec39f0  dunamai-1.22.0.tar.gz
"
