# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=py3-imageio
pkgver=2.35.1
pkgrel=0
pkgdesc="Python library that provides an easy interface to read and write a wide range of image data"
url="https://github.com/imageio/imageio"
license="BSD-2-Clause"
# ppc64le: test failures
# s390x: freeimage
arch="noarch !ppc64le !s390x"
depends="py3-numpy py3-pillow freeimage"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-psutil py3-imageio-ffmpeg py3-fsspec"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/i/imageio/imageio-$pkgver.tar.gz"
builddir="$srcdir/imageio-$pkgver"
options="!check" # intentionally fail without internet(?), todo

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	IMAGEIO_NO_INTERNET=1 .testenv/bin/python3 -m pytest -v
}

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

	# remove unneeded binaries
	# shellcheck disable=2115
	rm -r "$pkgdir"/usr/bin
}

sha512sums="
49257c2f02d6c0d7d6cc06e90673b6b5425f07b4daf937e1b7557b8bdf34c42c3b3c64a9a1e5e674f87814a39be503fe85538429c1bd313ef3d6fc55e3d26396  py3-imageio-2.35.1.tar.gz
"
