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

_realname=sphinx-alabaster-theme
_pyname=alabaster
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.7.12
pkgrel=1
pkgdesc="Modified Kr Sphinx doc theme (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('BSD')
url='https://github.com/bitprophet/alabaster'
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-pygments")
options=('staticlibs')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/bitprophet/alabaster/archive/${pkgver}.tar.gz")
sha256sums=('2f413c2a7e16f6b18d38f86a236b89e50e5f6ca79094ff948e5e58828f95c430')

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

build() {
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

check() {
  msg "Python test for ${CARCH}"  
  cd "${srcdir}/python-build-${CARCH}" 
  ${MINGW_PREFIX}/bin/python setup.py test
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
    ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1 --skip-build

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