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

_realname=sphinx_rtd_theme
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.4.3
pkgrel=1
pkgdesc="Python Sphinx Read The Docs Theme (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('MIT')
url='https://github.com/snide/sphinx_rtd_theme'
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=('staticlibs')
source=("https://pypi.org/packages/source/s/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('728607e34d60456d736cc7991fd236afb828b21b82f956c5ea75f94c8414040a')

prepare() {
  cd ${srcdir}
  cp -r ${_realname}-${pkgver} python-build-${CARCH}
}

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

check() {
  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}/COPYING"
}
