# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer:
pkgname=py3-networkx
pkgver=3.2.1
pkgrel=1
pkgdesc="Software for complex networks"
url="https://networkx.org/"
arch="noarch"
license="BSD-3-Clause"
depends="
	py3-matplotlib
	py3-numpy
	py3-pandas
	py3-scipy
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
subpackages="$pkgname-doc $pkgname-pyc"
checkdepends="
	graphviz
	py3-lxml
	py3-pydot
	py3-pygraphviz
	py3-pytest
	py3-pytest-xdist
	py3-yaml
	xdg-utils
	"
source="https://pypi.python.org/packages/source/n/networkx/networkx-$pkgver.tar.gz"
builddir="$srcdir/networkx-$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

	# Broken with graphviz
	# travellingsalesman:
	# https://github.com/networkx/networkx/issues/5913
	.testenv/bin/python3 -m pytest -n auto \
		--ignore networkx/drawing/tests/test_agraph.py \
		--ignore networkx/algorithms/approximation/tests/test_traveling_salesman.py \
		--ignore networkx/linalg/tests/test_algebraic_connectivity.py \
		-k "not test_connected_raise"
}

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

	find "$pkgdir" -type d -name tests -exec rm -r {} \+

	install -Dm644 LICENSE.txt -t "$pkgdir"/usr/share/doc/$pkgname/
	cp -a examples "$pkgdir"/usr/share/doc/$pkgname/
}

sha512sums="
579c54a4a016617f5260df01b821c3906c4f289e80ae7bd618c0ebb9e05ebe806e71f1f660e3012531d04572ac4e6670aa73117ed26da8248fbb8ef7228b5803  networkx-3.2.1.tar.gz
"
