# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

_realname=sphinx-lv2-theme
_pyname=sphinx_lv2_theme
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.4.2
pkgrel=2
pkgdesc="A minimal static theme for Sphinx (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://gitlab.com/lv2/sphinx_lv2_theme"
msys2_references=(
  'archlinux: python-sphinx-lv2-theme'
  'pypi: sphinx-lv2-theme'
)
license=("spdx:0BSD")
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python-build"
  "${MINGW_PACKAGE_PREFIX}-python-installer"
  "${MINGW_PACKAGE_PREFIX}-python-setuptools"
)
depends=("${MINGW_PACKAGE_PREFIX}-python-sphinx")
source=("https://pypi.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
sha256sums=('4a099ae20c427179c0cf081f01d5366a554778480d89c2d77a033467e06e7c38')

build() {
  cp -r "${_pyname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
