# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Clément DEMOULINS <clement@archivel.fr>

pkgname=python-networkx
pkgver=3.4.2
pkgrel=1
pkgdesc='Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks.'
arch=(any)
license=('BSD-3-Clause')
url="https://networkx.org/"
depends=('python-numpy' 'python-scipy' 'python-matplotlib' 'python-pandas')
optdepends=('python-lxml: for GraphML XML format'
            'python-pydot: for graph drawing and graph layout algorithms in pure Python via GraphViz'
            'python-pygraphviz: for graph drawing and graph layout algorithms with bindings to GraphViz'
            'python-sympy: for polynomial algorithms')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-setuptools')
checkdepends=('python-pytest' 'python-lxml' 'python-pydot' 'python-pygraphviz')
source=("https://github.com/networkx/networkx/archive/networkx-$pkgver.tar.gz")
sha512sums=('709962e921d4ad63cf5386dda39c6c57ba6739a1243dd93b200651902c907bdeb98db52f69c8a0c258c5d57fe65c5cd02daeb06ba46655ed82b1bb9ae8728129')

build() {
  cd networkx-networkx-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd networkx-networkx-$pkgver
  pytest -v
}

package() {
  cd networkx-networkx-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -D -m 644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.txt
  mkdir -p "$pkgdir"/usr/share/doc/$pkgname
  cp -r examples "$pkgdir"/usr/share/doc/$pkgname
}
