# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
maintainer="Holger Jaekel <holger.jaekel@gmx.de>"
pkgname=py3-fiona
pkgver=1.10.1
pkgrel=1
pkgdesc="Fiona reads and writes geographical data files"
url="https://github.com/Toblerity/Fiona"
arch="all"
license="BSD-3-Clause"
depends="
	cython
	gdal
	gdal-dev
	python3
	python3-dev
	py3-attrs
	py3-click<8.2
	py3-click-plugins
	py3-cligj
	py3-certifi
	py3-fsspec
	py3-munch
	py3-setuptools
	py3-shapely
	py3-six
	py3-tz
	"
checkdepends="py3-pytest py3-pytest-cov py3-boto3"
makedepends="py3-gpep517 py3-wheel"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/f/fiona/fiona-$pkgver.tar.gz
	patch-vendor.patch
	"
builddir="$srcdir/fiona-$pkgver"

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

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

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

	# conflicts with fio package
	mv "$pkgdir"/usr/bin/fio "$pkgdir"/usr/bin/fiona-fio
}

sha512sums="
68f0e88ee5ffc03e80db7d71a62912e69c90153cd9dd2103e00768d42f894433c1d3539dfcb07e38d81aa029496b9b950a6ee268f03fccb1259f52702632bdfc  py3-fiona-1.10.1.tar.gz
0f9daebc982ead978e8e192e988593e2a10745ecba2d44a1f94d994e9fdcd1647de5b71f891c536f681f1a1a8be4fb416e50e27cb762811da333ec915bde4638  patch-vendor.patch
"
