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

pkgname=python-rdflib
pkgver=7.1.2
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=('e726105357a10eeb788e0ad4364667bdb2a5dc6a45f50eec2fb64d6727aa0f0fa654720ce98421bda129066efdcc3b999d3f5e959c6016bc4ac5f49e8a0454b8')

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/
}
