# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pyproject-api
pkgver=1.7.1
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="
3ac4f7913ffaad7daa71b806482e74e76d19c50e1dcb08d48114aaee016fb80dc364ac1a95cb8d535b4531746dac1853a3c7f308c7f300c512c1ed99e8db86f3  py3-pyproject-api-1.7.1.tar.gz
"
