# Maintainer: Peter Budai <peterbudai@hotmail.com>

_realname=sphinxcontrib-moderncmakedomain
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=3.19
pkgrel=1
pkgdesc="Sphinx Domain for Modern CMake (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('CMake')
url="https://github.com/slurps-mad-rips/moderncmakedomain"
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-pytest")
source=("${_realname}-${pkgver}.tar.gz"::"https://pypi.org/packages/source/s/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('b2900cc170b94ad53c59ae50a01961dc4c3ae9c12a8ec582d017b17abd69cea1')

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/py.test || warning "test failed"
}

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