# Maintainer: Frederic Wang <fred.wang@free.fr>

_realname=pyasn1-modules
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.2.8
pkgrel=1
pkgdesc='A collection of ASN.1-based protocols modules (mingw-w64)'
url='https://github.com/etingof/pyasn1-modules/'
license=('BSD')
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
depends=("${MINGW_PACKAGE_PREFIX}-python-pyasn1")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/etingof/pyasn1-modules/archive/v${pkgver}.tar.gz")
sha256sums=('c562fcf94e21b19b1b01c103a4dbe24b286356237d2b453afd75882683cf0ad7')

prepare() {
  cd ${srcdir}
  cp -r ${_realname}-${pkgver} build-python-${CARCH}
}

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

package() {
  cd "${srcdir}/build-python-${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 "${srcdir}/${_realname}-${pkgver}/LICENSE.txt" "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
