# Contributor: Marian Buschsieweke <marian.buschsieweke@posteo.net>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-qtgraph
pkgver=0.13.7
pkgrel=0
pkgdesc="Scientific Graphics and GUI Library for Python"
url="https://www.pyqtgraph.org/"
arch="noarch"
license="MIT"
depends="
	py3-numpy
	py3-opengl
	py3-qt5
	py3-scipy
	python3
	"
makedepends="
	py3-gpep517
	py3-setuptools
	"
checkdepends="
	py3-pytest
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/pyqtgraph/pyqtgraph/archive/pyqtgraph-$pkgver.tar.gz"
builddir="$srcdir/pyqtgraph-pyqtgraph-$pkgver"

# tests fail in CI as import of python module OpenGL.GL fails. It appears an
# OpenGL capabale GPU + OpenGl stack is needed despite tests are running in
# headless mode.
options="!check"

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl

	unset DISPLAY WAYLAND_DISPLAY

	env QT_QPA_PLATFORM=offscreen .testenv/bin/python3 -m pytest
}

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

sha512sums="
91e06e143fec4b1a6fae5cc7112a1fb6b7e74c7a38605172aacc5639eb220e30c54694e419313c7bb8368ea5c5f45f41d58e4510735e63a7d6ef03cdbb0f05e9  py3-qtgraph-0.13.7.tar.gz
"
