# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-pep440
pkgver=0.1.2
pkgrel=4
pkgdesc="Checks whether version numbers are PEP440 compliant"
url="https://github.com/Carreau/pep440"
arch="noarch"
license="MIT"
makedepends="py3-gpep517 py3-flit-core"
checkdepends="py3-pytest py3-pytest-console-scripts"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Carreau/pep440/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/pep440-$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

	# test_cli.py tries to run "pep440" executable
	PATH="$builddir/.testenv/bin:$PATH" .testenv/bin/python3 -m pytest
}

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

sha512sums="
d52c69fb15ec979c916620a4d07bd4625c2e9b3a0bc29464b35a1bc1ec76cccd6c9f5cbb2f989e578333c15d0f451c15aa3cfc4654290dedde48e6291f184cab  py3-pep440-0.1.2.tar.gz
"
