# Maintainer: Carl Smedstad <carsme@archlinux.org>

pkgname=python-sphinx-book-theme
pkgver=1.2.0
pkgrel=1
pkgdesc='A clean book theme for scientific explanations and documentation with Sphinx'
arch=('any')
url="https://github.com/executablebooks/sphinx-book-theme"
license=('BSD-3-Clause')
depends=(
  'python'
  'python-docutils'
  'python-pydata-sphinx-theme'
  'python-sphinx'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-sphinx-theme-builder'
  'python-wheel'
)
checkdepends=(
  'python-pytest'
  'python-pytest-regressions'
)
source=("$url/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
b2sums=('fc958965095fd68b4d7d5efcfec9820cf8e465685d864605ec90005aef597a26f0b047336dbbfe4442b396f65c3549067d098743e4e628e1a2cf8d6a9ab5b640')

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

check() {
  cd ${pkgname#python-}-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  # Other tests require python-myst-nb which is not in the repos.
  test-env/bin/python -m pytest tests/test_locale_convert.py
}

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