# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=python-rpds-py
pkgver=0.30.0
pkgrel=2
pkgdesc='Python bindings to the Rust rpds crate for persistent data structures'
arch=(x86_64 aarch64)
url='https://github.com/crate-py/rpds'
license=(MIT)
depends=(
  glibc
  gcc-libs
  python
)
makedepends=(
  git
  python-build
  python-maturin
  python-installer
)
source=("$pkgname::git+$url#tag=v$pkgver")
sha512sums=('72c235574bfbbb1559aa97f228e87ba11c9d165bfabe690d27e59086d4d4b428fca18d858d258aee7f4835fc77f04a587765f7f1c605d1b4557c9a3ac304c816')
b2sums=('a0c2b8438f4dd5feaf5eb75101216d12bea91ccf85e1ae07a6e8e5918b35b07aefd8517241d4cfe7a808655ecffb8a52c8071d4da7f72c610657828526b3a88f')

prepare() {
  cd "$pkgname"

  # download dependencies
  cargo fetch --locked --target "$(rustc --print host-tuple)"
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
