# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=future
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=1.0.0
pkgrel=3
pkgdesc="Clean single-source support for Python 3 and 2 (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://python-future.org/'
msys2_references=(
  'purl: pkg:pypi/future'
  "cpe: cpe:/a:pythoncharmers:python-future"
)
license=('spdx:MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-requests")
options=(!strip)
source=("https://pypi.io/packages/source/f/future/future-${pkgver}.tar.gz")
sha256sums=('bd2968309307861edae1458a4f8a4f3598c03be43b97521076aebf5d94c07b05')

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

check() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python -m pytest
}

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.txt"
}
