# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-prometheus-client
pkgver=0.20.0
pkgrel=2
pkgdesc="Python3 client for the Prometheus monitoring system"
url="https://github.com/prometheus/client_python"
arch="noarch"
license="Apache-2.0"
depends="python3 py3-twisted"
makedepends="python3-dev py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-asgiref py3-pytest"
subpackages="$pkgname-pyc"
source="https://pypi.io/packages/source/p/prometheus_client/prometheus_client-$pkgver.tar.gz
	label.patch
	"
builddir="$srcdir/prometheus_client-$pkgver"

build() {
	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
	# https://github.com/prometheus/client_python/issues/1020
	.testenv/bin/python3 -m pytest \
		--ignore=tests/test_asgi.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
9e5aed628b052790af8954eee7914b6480226368229bb0dade2f8c3f88ab04971d2a8a55558fd7dbb125894f30cea56363cc670deb0aa6822f31562437031fb2  prometheus_client-0.20.0.tar.gz
52332b6c760e3f0cadb0471a96a2b4437355d0ee653507e51129092745a6b582648f50713138525df33281431b88291533edd3d65dec6a1db9166d97fad34ab3  label.patch
"
