# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_pyname=ndg_httpsclient
_realname=ndg-httpsclient
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=0.5.1
pkgrel=8
pkgdesc="Provides enhanced HTTPS support for httplib and urllib2 using PyOpenSSL (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://github.com/cedadev/ndg_httpsclient/'
msys2_references=(
  'purl: pkg:pypi/ndg-httpsclient'
)
license=('spdx:BSD-3-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-pyopenssl"
         "${MINGW_PACKAGE_PREFIX}-python-pyasn1")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=(!strip)
source=("https://pypi.org/packages/source/n/${_realname}/${_pyname}-${pkgver}.tar.gz")
sha256sums=('d72faed0376ab039736c2ba12e30695e2788c4aa569c9c3e3d72131de2592210')

build() {
  cp -r "${_pyname}-${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
}
