# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Daniel Micay <danielmicay@gmail.com>

pkgname=python-scrypt
pkgver=0.8.24
pkgrel=2
pkgdesc='Bindings for the scrypt key derivation function library'
url='https://github.com/holgern/py-scrypt'
arch=('x86_64' 'aarch64')
license=('BSD-2-Clause')
depends=('python' 'glibc' 'openssl')
makedepends=('python-setuptools' 'python-build' 'python-installer' 'python-wheel')
source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('55a3f5e30992e89f68f35269bcffe977d799e353eff4d5e7a72159850fc838c28c68e6d008cf2470cc7c554755fd81c022543ab2860e9a93504c99d95409c2a3')
b2sums=('3290c361750fb12409f6d507cd1cc00549cb77edfe2eacc273881642aea9a9f7a42727e138654a2a968d9e8c7819351fb61b7a63266ef36695153670f4e2ac82')

build() {
  cd py-scrypt-${pkgver}
  python -m build --wheel --no-isolation
}

check() {
  cd py-scrypt-${pkgver}
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-${python_version}" python -m unittest discover -vs .
}

package() {
  cd py-scrypt-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  rm -r "${pkgdir}"/usr/lib/python*/site-packages/scrypt/tests
  install -Dm 644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
