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

pkgname=python-fixtures
pkgver=4.2.8
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=('204c94f6566d4d39f60672bf30ad4894f71231655f9e67664898bc57a26997c5680ca72bbc4752242d1144f7ee792caab689e07ad0096e1549be8074b9a10c51')

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
}
