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

_realname=sphinxcontrib-svg2pdfconverter
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.1.1
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
pkgdesc="Sphinx SVG to PDF converter extension (mingw-w64)"
url="https://github.com/sephalon/sphinxcontrib-svg2pdfconverter/"
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-python-sphinx")
optdepends=("${MINGW_PACKAGE_PREFIX}-librsvg: Use librsvg engine"
            "${MINGW_PACKAGE_PREFIX}-inkscape: Use inkscape engine")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter/archive/v${pkgver}.tar.gz")
sha256sums=('0903415412976cc255a417d827c1bcffe4f1d0c756908d948bb97e956a568314')

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

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

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} --skip-build
  install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/License.txt"
}
