# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_pyname=jinja2
_realname=jinja
# this is a separate package to break the jinja2 <-> sphinx dependency cycle
pkgbase=mingw-w64-python-${_realname}-docs
pkgname="${MINGW_PACKAGE_PREFIX}-python-${_realname}-docs"
pkgver=3.1.6
pkgrel=1
pkgdesc="A simple pythonic template language written in Python (mingw-w64) (documentation)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://jinja.palletsprojects.com/"
msys2_repository_url="https://github.com/pallets/jinja"
msys2_references=(
  'purl: pkg:pypi/jinja2'
)
license=('spdx:BSD-3-Clause')
makedepends=("${MINGW_PACKAGE_PREFIX}-python-pallets-sphinx-themes"
             "${MINGW_PACKAGE_PREFIX}-python-sphinxcontrib-log-cabinet"
             "${MINGW_PACKAGE_PREFIX}-python-sphinx-issues")
source=(https://pypi.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz)
sha256sums=('0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d')

prepare() {
  rm -rf python-build-${MSYSTEM} | true
  cp -r "${_pyname}-${pkgver}" "python-build-${MSYSTEM}"
}

build() {
  msg "Build documentation"
  cd "${srcdir}/python-build-${MSYSTEM}/docs"
  make html
}

package() {
  mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname}"
  cp -a "${srcdir}/python-build-${MSYSTEM}/docs/_build/html" "${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname}/html"
}
