# Maintainer: Balló György <ballogyor+arch at gmail dot com>

_pkgname=argon2_cffi
pkgname=python-argon2_cffi
pkgver=23.1.0
pkgrel=2
pkgdesc="CFFI-based Argon2 Bindings for Python"
arch=('x86_64' 'aarch64')
url="https://github.com/hynek/argon2_cffi"
license=('MIT')
depends=(python-argon2-cffi-bindings)
makedepends=(git python-hatch-vcs python-hatch-fancy-pypi-readme python-build python-installer)
_commit=7d3edeffeea9beda84e14a2a0a595b0068fa1f0e
source=("git+https://github.com/hynek/argon2_cffi#commit=$_commit"
        "git+https://github.com/p-h-c/phc-winner-argon2")
sha256sums=('SKIP'
            'SKIP')

pkgver() {
  cd $_pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $_pkgname
  git submodule init
  git config --local submodule.extras/libargon2.url "$srcdir/phc-winner-argon2"
  git submodule update
}

build() {
  cd $_pkgname
  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd $_pkgname
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
