# Maintainer: Daniel M. Capella <polyzen@archlinux.org>

pkgname=python-accessible-pygments
_name=${pkgname#python-}
pkgver=0.0.5
pkgrel=2
pkgdesc='Collection of accessible pygments styles'
arch=(any)
url=https://github.com/Quansight-Labs/accessible-pygments
license=(BSD-3-Clause)
depends=(
  python-pygments
)
makedepends=(
  git
  python-build
  python-hatch-fancy-pypi-readme
  python-hatch-vcs
  python-hatchling
  python-installer
)
checkdepends=(
  python-hypothesis
  python-pytest
)
source=("git+$url.git#tag=v$pkgver")
b2sums=('cf3ff417835adbff4e4323ccb796d5d7313b62ace76d7c780fcccad7f5d49b70faf926b81a8e7a48ec6dc46049d3ccffd365d957903c11f6206a58a3505f5444')

build() {
  cd "$_name"
  python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  cd "$_name"
python -m pytest test/test_*.py
}

package() {
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/"${_name//-/_}"-$pkgver.dist-info/licenses/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

  cd "$_name"
  python -m installer --destdir="$pkgdir" dist/*.whl
}
