# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pyproject-api
pkgver=1.9.0
pkgrel=1
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="
01f0b52bd6a12253da0034a1921084aea0e9f900b6de674e81179765ed8dff3976c27b9674b5edb7be9cadc65ac275f1f4cf3ba39e54dc6bba5af27b175bcf38  py3-pyproject-api-1.9.0.tar.gz
"
