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

pkgname=python-fixtures
pkgver=4.2.6
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")
sha512sums=('22e14a5035797aa006556ae8eb302ad43cc77a74414d529882e95289c3df20f7d1b2c375e5e8be47e76b56dce8166c1f58f2faabe74aa17c19478a5f392e29f0')

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 fixtures.test_suite
}

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