# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pyproject-api
pkgver=1.8.0
pkgrel=0
pkgdesc="Python API to interact with the python pyproject.toml based projects"
url="https://github.com/tox-dev/pyproject-api"
arch="noarch"
license="MIT"
depends="py3-packaging"
makedepends="
	py3-gpep517
	py3-hatch-vcs
	py3-hatchling
	"
checkdepends="
	py3-pytest
	py3-pytest-cov
	py3-pytest-mock
	py3-virtualenv
	py3-wheel
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/tox-dev/pyproject-api/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/pyproject-api-$pkgver"

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	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="
dbff126fa1e2cc31fd373ff7e51053aeb633fd38f1d678c6afef55cc0b5e235c19b2d79760269912e56114375224715cfc29c8f2f881af80366fe807fe4db6c2  py3-pyproject-api-1.8.0.tar.gz
"
