# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: j605

_name=pyperf
pkgname='python-perf'
pkgver=2.6.3
pkgrel=1
pkgdesc='Toolkit to run Python benchmarks'
url='https://github.com/psf/pyperf'
arch=(any)
license=('MIT')
depends=('python' 'python-psutil')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
provides=(python-pyperf)
source=($url/archive/$pkgver/$_name-$pkgver.tar.gz)
sha512sums=('11d9959163843c048f0b628db688b4ab7e103e06ac073e93631295886e6ecb24de8055fc935f30fbc1ee3555e865d3e44931ac79562d9a3b5387fec80b1f0fbf')
b2sums=('e7746b8a01a5573ead65f3792d118c7898443f898fa308712518044ae572ae4b37193889a7ec95c4ab10686c1f951254cdb868a6a56cce8a9900a95113356927')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd $_name-$pkgver
  python -m installer --destdir=test_dir dist/*.whl
  export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"

  python -m unittest discover -s $_name/tests/ -v
}

package(){
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
