# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
maintainer="Holger Jaekel <holger.jaekel@gmx.de>"
pkgname=py3-shapely
pkgver=2.0.6
pkgrel=1
pkgdesc="Manipulation and analysis of geometric objects in the Cartesian plane"
url="https://pypi.org/project/Shapely"
arch="all"
license="BSD-3-Clause"
depends="
	py3-numpy
	"
makedepends="
	cython
	geos-dev
	py3-gpep517
	py3-matplotlib
	py3-numpy-dev
	py3-packaging
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="
	py3-pytest
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/s/shapely/shapely-$pkgver.tar.gz
	"
builddir="$srcdir/shapely-$pkgver"

build() {
	# Workaround for build with GCC 14
	# https://github.com/shapely/shapely/issues/2081
	CFLAGS="$CFLAGS -Wno-error=incompatible-pointer-types" \
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	mv shapely backup
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -x
	mv backup shapely
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	rm -r "$pkgdir"/usr/lib/python3.*/site-packages/shapely/tests
}

sha512sums="
f1a9e0a5156dc37ad894eb41fea9a1426e1fcc8cd40b2d3af94dbbe2f65c49f134fc1ad3d4a8b7bdad6a4d04af4c2a24443d37c6ed114c70ef67149ed9067e19  shapely-2.0.6.tar.gz
"
