# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-unearth
pkgver=0.17.2
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="
21c252898fc14dcdf6c7c18591116edec09c25b9e379999b4914af3f2b1474fd35b113afce5ce8fa16cd82abe192d0d2d2c6c8a84888814a74bb170a4e27dc5a  py3-unearth-0.17.2.tar.gz
"
