# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-rpds-py
pkgver=0.22.1
pkgrel=0
pkgdesc="Python bindings to the Rust Persistent Data Structures (rpds) crate"
url="https://github.com/crate-py/rpds"
arch="all"
license="MIT"
makedepends="
	cargo
	py3-gpep517
	py3-maturin
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://github.com/crate-py/rpds/releases/download/v$pkgver/rpds_py-$pkgver.tar.gz"
builddir="$srcdir/rpds_py-$pkgver"
options="net" # Required to download Rust crates

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--config-json '{"build-args": "--frozen"}' \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
344070477b51f0e9d2a0b5b565fabd63b98e4aae738df2d10411976f64905693ea7a63b71f25ac7c12c19ca24c2595c52640b804ac5ffb9ef4f163ecc200d6ad  rpds_py-0.22.1.tar.gz
"
