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

pkgname=python-sphinx-book-theme
pkgver=1.1.4
pkgrel=2
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")
sha512sums=('1fcc19f9080050b7ab7eba2b6fe0df9218ba87fe7ea2dd9bfa1cbd43d9fa777723ab0d882f94077f32564b22a8e95a6317fc490263a5a4f14766bb122c73b5bd')

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
}
