# Maintainer: Sarah Ottinger <schalaalexiazeal@gmail.com>
# Contributor: @naveen521kk on Github, Naveen M K <naveen521kk@gmail.com>

_realname=typing_extensions
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=4.15.0
pkgrel=1
pkgdesc='Backported and Experimental Type Hints for Python 3.5+ (mingw-w64)'
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: python-typing_extensions'
  'purl: pkg:pypi/typing-extensions'
)
url="https://github.com/python/typing_extensions"
msys2_changelog_url='https://github.com/python/typing_extensions/blob/main/CHANGELOG.md'
license=('spdx:PSF-2.0')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=(
    "${MINGW_PACKAGE_PREFIX}-python-build"
    "${MINGW_PACKAGE_PREFIX}-python-installer"
    "${MINGW_PACKAGE_PREFIX}-python-flit-core"
)
source=("https://pypi.python.org/packages/source/${_realname:0:1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466')

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 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
