# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Leif Warner <abimelech@gmail.com>

pkgname=python-rdflib
pkgver=7.6.0
pkgrel=1
pkgdesc="A Python library for working with RDF, a simple yet powerful language for representing information"
arch=('any')
url="https://github.com/RDFLib/rdflib"
license=('BSD-3-Clause')
depends=('python-pyparsing')
makedepends=('git' 'python-build' 'python-installer' 'python-poetry-core')
checkdepends=('python-pytest' 'python-networkx' 'python-lxml' 'python-orjson')
source=(
  git+https://github.com/RDFLib/rdflib.git#tag=$pkgver
)
sha512sums=('c394cc97ceb1d07bc7cb98575b3c1e1146330cd0c14d69684b8eed43f06f4818ef8e5e977dbe695cf6a07f9cf0af39b112733d92f536834bb3202f4639987921')

build() {
  cd rdflib
  python -m build --wheel --no-isolation
}

check() {
  cd rdflib
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  local pytest_args=(
    -v
    # Requires python-pytest-cov.
    --deselect=test/test_misc/test_plugins.py::test_parser
    --deselect=test/test_misc/test_plugins.py::test_sparqleval
  )
  test-env/bin/python -m pytest "${pytest_args[@]}"
}

package() {
  cd rdflib
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
