# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgname=python-jinja
_name="${pkgname#python-}"
pkgver=%version%
pkgrel=%release%
epoch=1
pkgdesc="A simple pythonic template language written in Python"
arch=('any')
url="https://palletsprojects.com/p/jinja/"
license=('BSD-3-Clause')
depends=('python' 'python-markupsafe')
makedepends=('python-setuptools')
optdepends=('python-babel: for i18n support')
checkdepends=('python-pytest')
source=($_name-$pkgver.tar.gz::https://github.com/pallets/jinja/archive/refs/tags/$pkgver.tar.gz)
sha256sums=('fe349bfd610cba6e688274df6eda339a60a59189cb114cd769ecde49f9a5dcbe')

prepare() {
  cd $_name-$pkgver
}

build() {
  cd $_name-$pkgver
  python3 setup.py build
}

check() {
  cd $_name-$pkgver
  # https://github.com/pypa/setuptools/issues/2466
  PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=build/lib pytest \
    --deselect tests/test_loader.py::test_package_dir_list \
    --deselect tests/test_loader.py::test_package_dir_source \
    --deselect tests/test_loader.py::test_package_file_list \
    --deselect tests/test_loader.py::test_package_file_source \
    --deselect tests/test_loader.py::test_package_zip_list \
    --deselect tests/test_loader.py::test_package_zip_omit_curdir \
    --deselect tests/test_loader.py::test_package_zip_source
}

package() {
  cd $_name-$pkgver
  python3 setup.py install --root="$pkgdir" --optimize=1 --skip-build
  install -Dm644 LICENSE.rst -t "$pkgdir/usr/share/licenses/$pkgname"
}

# vim:set ts=2 sw=2 et:
