# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-testrepository
pkgver=0.0.21
pkgrel=3
pkgdesc="A repository of test results."
arch=('any')
license=('Apache-2.0 OR BSD-3-Clause')
url="https://launchpad.net/testrepository"
depends=('python' 'python-testtools' 'python-fixtures' 'python-subunit')
makedepends=('python-hatchling' 'python-hatch-vcs' 'python-build' 'python-installer' 'python-wheel')
checkdepends=('python-testresources' 'python-pytz' 'python-testscenarios')
source=("$pkgname-$pkgver.tar.gz::https://github.com/testing-cabal/testrepository/archive/refs/tags/$pkgver.tar.gz")
sha512sums=('90fadfc78831f03e42cba08e2dab31fe15dcd61e9d78c726afcd99c84368fff4ff38ff715d60f5573058354ebf6d17e60f981a2bcae953fd95229ee41400ea3d')

build() {
  cd testrepository-$pkgver
  SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver python -m build --wheel --no-isolation
}

check() {
  cd testrepository-$pkgver
  python ./testr init
  python ./testr run --parallel
}

package() {
  cd testrepository-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 Apache-2.0 BSD -t "$pkgdir/usr/share/licenses/$pkgname/"
}
