# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.su>

_realname=passlib
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-$_realname")
pkgver=1.7.4
pkgrel=3
pkgdesc="A password hashing library for Python (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://passlib.readthedocs.io/"
msys2_repository_url="https://foss.heptapod.net/python-libs/passlib"
msys2_references=(
  'purl: pkg:pypi/passlib'
)
license=('spdx:BSD-3-Clause')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
             "${MINGW_PACKAGE_PREFIX}-python-installer"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
optdepends=(#"${MINGW_PACKAGE_PREFIX}-python-fastpbkdf2: accelerate PBKDF2-based hashes"
            #"${MINGW_PACKAGE_PREFIX}-python-scrypt: accelerate SCrypt hashes"
            "${MINGW_PACKAGE_PREFIX}-python-bcrypt: accelerate Bcrypt hashes")
source=("https://pypi.io/packages/source/p/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04')

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 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
  install -Dm644 README "${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname}/README"
}

# vim:set ts=2 sw=2 et:
