# Maintainer: Carl Smedstad <carsme@archlinux.org>

pkgname=python-ndindex
_pkgname=${pkgname#python-}
pkgver=1.10.0
pkgrel=1
pkgdesc="Library for manipulating indices of ndarrays"
arch=(x86_64 aarch64)
url="https://quansight-labs.github.io/ndindex/"
license=(MIT)
depends=(
  glibc
  python
  python-numpy
)
makedepends=(
  cython
  python-build
  python-installer
  python-setuptools
  python-versioneer
  python-wheel
)
checkdepends=(
  python-hypothesis
  python-pytest
  python-sympy
)
source=("$pkgname-$pkgver.tar.gz::https://github.com/Quansight-Labs/ndindex/archive/$pkgver/$pkgver.tar.gz")
sha256sums=('5b13e6acbe4e9b3faf71693f988aeb62e15d39d1808033072f8fbb7674f66f93')

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

check() {
  cd "$_pkgname-$pkgver"
  python -m installer --destdir=tmp_install dist/*.whl
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  cd "$PWD/tmp_install/$site_packages"
  pytest --override-ini="addopts=" -W ignore::pytest.PytestUnknownMarkWarning
}

package() {
  cd "$_pkgname-$pkgver"
  python -m installer --destdir="$pkgdir" dist/*.whl
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  rm -r "$pkgdir/$site_packages/ndindex/tests"
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
