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

_realname=zope.event
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=5.1.1
pkgrel=1
pkgdesc='Very basic event publishing system (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/zopefoundation/zope.event'
msys2_references=(
  'archlinux: python-zope-event'
  'purl: pkg:pypi/zope-event'
)
license=('spdx:ZPL-2.1')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("https://pypi.org/packages/source/${_realname::1}/${_realname/./_}/${_realname/./_}-${pkgver}.tar.gz")
sha256sums=('c1ac931abf57efba71a2a313c5f4d57768a19b15c37e3f02f50eb1536be12d4e')

build() {
  cp -r "${_realname/./_}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${srcdir}"/python-build-${MSYSTEM}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
    ${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl

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