# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=py3-imageio-ffmpeg
pkgver=0.4.9
pkgrel=1
pkgdesc="FFMPEG wrapper for Python"
url="https://github.com/imageio/imageio-ffmpeg"
arch="noarch"
license="BSD-2-Clause"
depends="ffmpeg python3 py3-setuptools"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-psutil py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/imageio/imageio-ffmpeg/archive/v$pkgver.tar.gz
	0001-Add-a-null-filter-to-re-enable-frame-count.patch"
builddir="$srcdir/imageio-ffmpeg-$pkgver"

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

	# ppc64le fails test_write_pix_fmt_in with assert error
	case "$CARCH" in
	ppc64le)
		.testenv/bin/python3 -m pytest \
			--deselect tests/test_io.py::test_write_pix_fmt_in
		;;
	*)
		.testenv/bin/python3 -m pytest
		;;
	esac
}

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

sha512sums="
ebf63b9ac9c733d4c12d3aa4c6a9e81dd0128795a040e65df03bfae00e3562a3976eaa2f4058562bbddc3f8d63d6bf2a38133de4d2ddb0d2dc62ffab2449e143  py3-imageio-ffmpeg-0.4.9.tar.gz
0f6bdffc68c802573b934366f565637b33aa00e9c7f68c2ec130122be5fc6ac11a674c3bccb97caa396df0edc028b59fdf87ddd79ec640593d11fdf6b4f95ec9  0001-Add-a-null-filter-to-re-enable-frame-count.patch
"
