# Maintainer: Biswapriyo Nath <nathbappai@gmail.com>

_realname=service-identity
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=24.2.0
pkgrel=3
pkgdesc="Service Identity Verification for pyOpenSSL and cryptography (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
msys2_references=(
  'archlinux: python-service-identity'
  'purl: pkg:pypi/service-identity'
)
msys2_repository_url='https://github.com/pyca/service-identity/'
url='https://service-identity.readthedocs.io/'
license=('spdx:MIT')
provides=("${MINGW_PACKAGE_PREFIX}-python-service_identity")
replaces=("${MINGW_PACKAGE_PREFIX}-python-service_identity")
depends=(
  "${MINGW_PACKAGE_PREFIX}-python"
  "${MINGW_PACKAGE_PREFIX}-python-attrs"
  "${MINGW_PACKAGE_PREFIX}-python-cryptography"
  "${MINGW_PACKAGE_PREFIX}-python-pyasn1"
  "${MINGW_PACKAGE_PREFIX}-python-pyasn1-modules"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python-build"
  "${MINGW_PACKAGE_PREFIX}-python-hatch-fancy-pypi-readme"
  "${MINGW_PACKAGE_PREFIX}-python-hatchling"
  "${MINGW_PACKAGE_PREFIX}-python-installer"
)
optdepends=("${MINGW_PACKAGE_PREFIX}-python-idna: for Internationalized Domain Names support")
source=("https://pypi.org/packages/source/${_realname::1}/${_realname/-/_}/${_realname/-/_}-${pkgver}.tar.gz")
sha256sums=('b8683ba13f0d39c6cd5d625d2c5f65421d6d707b013b375c355751557cbe8e09')

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