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

_realname=python-distutils-extra
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-distutils-extra")
provides=("${MINGW_PACKAGE_PREFIX}-python3-distutils-extra")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-distutils-extra")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-distutils-extra")
pkgver=2.39
pkgrel=1
pkgdesc="Enhancements to the Python build system (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('GPL')
url="https://launchpad.net/python-distutils-extra"
depends=("${MINGW_PACKAGE_PREFIX}-python>=3.3"
         "intltool")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("https://launchpad.net/${_realname}/trunk/${pkgver}/+download/${_realname}-${pkgver}.tar.gz"
        "https://launchpad.net/${_realname}/trunk/${pkgver}/+download/${_realname}-${pkgver}.tar.gz.asc")
validpgpkeys=("3DB46B55EFA59D40E6232148D14EF15DAFE11347") # Martin Pitt <martinpitt@gnome.org>
sha256sums=('723f24f4d65fc8d99b33a002fbbb3771d4cc9d664c97085bf37f3997ae8063af'
            'SKIP')

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

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

check() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${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}" --skip-build
}
