# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: David Verelst <david dot verelst at gmail com>
# Contributor: richli

pkgname=python-shapely
pkgver=2.0.3
pkgrel=1
pkgdesc="Manipulation and analysis of geometric objects in the Cartesian plane"
arch=(x86_64 aarch64)
url="https://pypi.python.org/pypi/Shapely"
license=(BSD)
depends=(geos python)
optdepends=('python-numpy: for shapely.vectorized submodule')
makedepends=(python-build python-installer python-setuptools python-wheel python-numpy cython)
checkdepends=(python-pytest)
source=("https://pypi.io/packages/source/s/shapely/shapely-${pkgver}.tar.gz")
sha512sums=('4ac5c7d78a9d69332c974ef0ff85deb966a6693a6c8973f22b4ce62a6882c7e6d1003536e1df9cf07e48996b8eb263e5596ae378bf5201a583337d0bc4cb861c')

build() {
  cd shapely-$pkgver
  python -m build --wheel --no-isolation --skip-dependency-check
}

check() {
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  cd shapely-$pkgver/build/lib.linux-$CARCH-cpython-${python_version}
  PYTHONPATH="$PWD" pytest -vv --color=yes
}

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