# Maintainer: Johannes Löthberg <johannes@kyriasis.com>

pkgname=python-prometheus_client
pkgver=0.23.1
pkgrel=1

pkgdesc="Prometheus instrumentation library for Python applications"
url="https://github.com/prometheus/client_python"
arch=('any')
license=('APACHE')

depends=('python')
makedepends=('python-setuptools' 'python-build' 'python-installer' 'python-wheel')
checkdepends=('python-twisted' 'python-pytest')

source=(client_python-$pkgver.tar.gz::https://github.com/prometheus/client_python/archive/v${pkgver}.tar.gz)

sha512sums=('475fa17b7f97c57ca0f062b6c5790245987ade455e02f090282273460002b38ca3327357d59b25d522e43436af7656e7b1806125d2bb5c382d3a29422561b7b0')

build() {
  cd client_python-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd client_python-$pkgver
  # Make reproducible by not writing pyc files for test files. (rebuilderd does not run tests)
  PYTHONDONTWRITEBYTECODE=1 python -m unittest discover -vs .
}

package() {
  cd client_python-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
}
