# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=propcache
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.4.1
pkgrel=1
pkgdesc='Fast property caching (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/aio-libs/propcache"
msys2_changelog_url='https://propcache.aio-libs.org/en/latest/changes/'
msys2_references=(
  'archlinux: python-propcache'
  'gentoo: dev-python/propcache'
  'purl: pkg:pypi/propcache'
)
license=('spdx:Apache-2.0')
depends=(
  "${MINGW_PACKAGE_PREFIX}-python"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python-build"
  "${MINGW_PACKAGE_PREFIX}-python-installer"
  "${MINGW_PACKAGE_PREFIX}-python-setuptools"
  "${MINGW_PACKAGE_PREFIX}-python-expandvars"
  "${MINGW_PACKAGE_PREFIX}-cython"
  "${MINGW_PACKAGE_PREFIX}-cc")
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('f48107a8c637e80362555f37ecf49abe20370e557cc4ab374f04ec4423c97c3d')

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

package() {
  cd "python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
