# Contributor: Brian Vuyk <bvuyk@sama.com>
# Maintainer: Brian Vuyk <bvuyk@sama.com>
pkgname=pdal-python-plugins
pkgver=1.6.2
pkgrel=0
pkgdesc="Supports embedding Python in PDAL pipelines with the readers.numpy and filters.python drivers."
url="https://github.com/PDAL/python-plugins"
arch="all !s390x" # Exclude s390x due to test failures.
license="BSD-3-Clause"
depends="python3 py3-numpy"
checkdepends="pdal"
makedepends="cmake pdal-dev py3-gpep517 py3-numpy-dev py3-pybind11
	py3-scikit-build-core python3-dev samurai"
source="https://files.pythonhosted.org/packages/source/p/pdal-plugins/pdal_plugins-$pkgver.tar.gz
	enable-tests.patch"
builddir="$srcdir/pdal_plugins-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	export WHEEL_DIR="$(python3 -m "scikit_build_core.builder.wheel_tag")"
	export PDAL_DRIVER_PATH="$builddir"/build/$WHEEL_DIR/Release
	# filters.python should appear in pdal output
	pdal --drivers

	# Copy test data where tests can find them
	cp -r "$builddir"/src/pdal/test/data $PDAL_DRIVER_PATH/src/pdal/test/
	$PDAL_DRIVER_PATH/pdal_filters_python_test
	$PDAL_DRIVER_PATH/pdal_io_numpy_test
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
}

sha512sums="
c8afd30dbce6c17609fb39bb88354237c5a52cf6987233f5e20afd6735df2c2481e5945c7e620816f6f483210ef4caf4e905afd2414e4065cd8cc8e0d08ef511  pdal_plugins-1.6.2.tar.gz
6597ac5f0218a080ae0510f87c534ed794914c0882118524c0a9ff91435e348b6a1f689f1122fde02dea04524dcc2ad2dc5bfc74e1477c15f8bc451b1e1453c5  enable-tests.patch
"
