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

pkgname=python-prometheus_client
pkgver=0.24.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' 'python-aiohttp' 'python-snappy' 'python-asgiref' 'python-django')
optdepends=('python-snappy: snappy compression support'
	    'python-aiohttp: aiohttp server support'
	    'python-django: django exporter support')

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

sha512sums=('5188472d93fe0e2a2ba36431d08dfd3af42dee5f39c32d600f8de4728ba8d9396ca4f3a35fc7370b4f23f9ba733d2c81db9464c9b8e6ce515523470edc8b8001')

prepare() {
  cd client_python-$pkgver
}

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 PYTHONPATH=. python -m unittest discover -vs .
}

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