# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-unearth
pkgver=0.17.5
pkgrel=0
pkgdesc="Utility to fetch and download python packages"
url="https://github.com/frostming/unearth"
arch="noarch"
license="MIT"
depends="py3-packaging py3-requests py3-httpx"
makedepends="py3-pdm-backend py3-gpep517 py3-installer py3-trustme"
checkdepends="
	py3-pytest
	py3-flask
	py3-requests-wsgi-adapter
	py3-pytest-httpserver
	py3-pytest-mock
"
subpackages="$pkgname-pyc"
source="https://github.com/frostming/unearth/archive/$pkgver/py3-unearth-$pkgver.tar.gz"
builddir="$srcdir/unearth-$pkgver"

build() {
	export PDM_BUILD_SCM_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="
0c4ed5af28c54ae342c7da268c8d8c7ada313cf77a68a47699bb3e4101a73ed566f8b8abbc1aa22a6357685f200bd4657f9e0d686dd5ffe08bb9df52ef497c17  py3-unearth-0.17.5.tar.gz
"
