# Maintainer: Antonio Rojas <arojas@archlinux.org>

_pyname=contourpy
pkgname=python-$_pyname
pkgver=1.3.3
pkgrel=1
pkgdesc='Python library for calculating contours in 2D quadrilateral grids'
arch=(x86_64 aarch64)
url='https://github.com/contourpy/contourpy'
license=(BSD)
depends=(gcc-libs
         glibc
         python
         python-numpy)
makedepends=(git
             meson-python
             pybind11
             python-build
             python-installer)
checkdepends=(python-matplotlib
              python-pytest
              python-wurlitzer)
optdepends=('python-matplotlib: matplotlib renderer')
source=(git+https://github.com/contourpy/contourpy#tag=v$pkgver)
sha256sums=('78f8a1e7825afc25b3fb583fc995aaf45b67288b6974bf17a92137c348708309')

prepare() {
  sed -e '/ninja/d' -i $_pyname/pyproject.toml
}

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

check() {
  cd $_pyname
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -v
}

package() {
  cd $_pyname
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
