# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
#This value is here because some python package names have capital letters
#while there is a strong preference for lowercase letters in ArchLinux and
#MSYS packages.

_realname=pgen2
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.1.0
pkgrel=1
pkgdesc="Pure Python implementation of pgen, the Python parser generator (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url='https://github.com/mythonlang/pgen2/'
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=('staticlibs' 'strip' '!debug')
_dtoken="2f/95/c36839d594d4f58b17e01a8e6f661f96337b546b8e4fd281d166cb5dc22a"
source=("https://pypi.python.org/packages/${_dtoken}/${_realname}-${pkgver}.tar.gz")
sha256sums=('a5057017c99eb45512f1cc772bae5953ed64104c1c705f0438aa00d06ee65804')

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

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  ${MINGW_PREFIX}/bin/python setup.py check -v -m
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

  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
}
