# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-graphviz
pkgver=0.20.3
pkgrel=1
pkgdesc="Simple interface for Graphviz"
url="https://github.com/xflr6/graphviz"
arch="noarch"
license="MIT"
depends="
	graphviz
	python3
	"
makedepends="py3-setuptools"
checkdepends="
	font-cantarell
	py3-pytest-cov
	py3-pytest-mock
	py3-pytest
	"
subpackages="$pkgname-pyc"
source="https://github.com/xflr6/graphviz/archive/$pkgver/graphviz-$pkgver.tar.gz"
builddir="$srcdir/graphviz-$pkgver"

replaces="py-graphviz" # for backwards compatibility
provides="py-graphviz=$pkgver-r$pkgrel" # for backwards compatibility

build() {
	python3 setup.py --quiet build
}

check() {
	# ignore conftest: https://github.com/pytest-dev/pytest/issues/12123
	# test_pipe requires graphviz built with triangulation library
	# jupyter_integration requires graphviz built with jpeg support / libgd
	pytest \
		--ignore tests/conftest.py \
		--ignore tests/backend/conftest.py \
		--deselect tests/backend/test_piping.py::test_pipe \
		--deselect graphviz/jupyter_integration.py::graphviz.jupyter_integration.JupyterIntegration._repr_mimebundle_
}

package() {
	python3 setup.py --quiet install --skip-build --root="$pkgdir"
}

sha512sums="
e920093e499a539b1c8b5b250f2feeb0829caffd7ad27ae762cb7d4f8762e20bc4c9c72ac2a8d0efbbc81a3eef3289f5f66eed6c6db45353c9d802594449f6ae  graphviz-0.20.3.tar.gz
"
