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

_pyname=pyproject_hooks
_realname=pyproject-hooks
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.2.0
pkgrel=1
pkgdesc="A low-level library for calling build-backends in pyproject.toml-based project (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: python-pyproject-hooks'
  'purl: pkg:pypi/pyproject-hooks'
)
msys2_repository_url='https://github.com/pypa/pyproject-hooks'
url='https://pyproject-hooks.readthedocs.io/'
license=('spdx:MIT')
depends=(
  "${MINGW_PACKAGE_PREFIX}-python"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python-flit-core"
  "${MINGW_PACKAGE_PREFIX}-python-installer"
)
source=("https://pypi.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
sha256sums=('1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8')

build() {
  cp -r "${_pyname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"

  python -m flit_core.wheel
}

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

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