# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>

pkgname=python-fixtures
pkgver=4.3.2
pkgrel=1
pkgdesc="Python fixtures for testing / resource management"
arch=('any')
url="https://github.com/testing-cabal/fixtures"
license=('Apache-2.0 OR BSD-3-Clause')
depends=('python')
makedepends=(
  'python-build'
  'python-hatch-vcs'
  'python-hatchling'
  'python-installer'
  'python-wheel'
)
checkdepends=('python-testtools')
source=("$url/archive/$pkgver/${pkgname#python-}-$pkgver.tar.gz")
b2sums=('e39042e831d0466e46bc26c035d0155dfddaa307123931f0b6b3a4aadafb96c018a38d88302eead1327140e38197fb52f2079493284c9ac9a27e90a126bd6ea3')

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

check() {
  cd ${pkgname#python-}-$pkgver
  python -m testtools.run tests.test_suite
}

package() {
  cd ${pkgname#python-}-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" COPYING BSD
}
