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

_realname=manhole
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.6.0
pkgrel=1
pkgdesc="Debugging manhole for python applications (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://github.com/ionelmc/python-manhole'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-pytest-runner"
              "${MINGW_PACKAGE_PREFIX}-python-requests"
              #"${MINGW_PACKAGE_PREFIX}-python-process-tests"
              #"${MINGW_PACKAGE_PREFIX}-python-virtualenv"
             )
options=('staticlibs' 'strip' '!debug')
source=("${_realname}-${pkgver}.tar.gz::https://github.com/ionelmc/python-manhole/archive/v$pkgver.tar.gz")
sha512sums=('179a87529e371c4480b6ab0ad6cc6cc9e3942f4be339cacaf1f1b100e447b8b1f2903a03879e9df3376c86ced4421aa5a16d934c9b250f91715b28d03dca000a')

prepare() {
  cd "${srcdir}"
  rm -rf python-build-${CARCH} || true
  cp -r "python-${_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}" --optimize=1 --skip-build

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