# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=py3-setuptools-rust
pkgver=1.10.2
pkgrel=0
pkgdesc="Setuptools plugin for rust support"
url="https://github.com/PyO3/setuptools-rust"
arch="noarch"
license="MIT"
depends="
	cargo
	py3-semantic-version
	py3-setuptools
	"
makedepends="
	py3-gpep517
	py3-setuptools_scm
	py3-wheel
	"
checkdepends="
	libffi-dev
	py3-pytest
	python3-dev
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/PyO3/setuptools-rust/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/setuptools-rust-$pkgver"
options="net" # check needs network access, no easy patch

export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver

prepare() {
	default_prepare

	# This test relies on behavior that may be glibc-specific
	mv -v examples/hello-world/noxfile.py \
		examples/hello-world/noxfile.py.disabled
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--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 tests/ setuptools_rust/
}

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

sha512sums="
0e085ffed62085fc342bf3c5250ac3d4c5c1a7e84cf57694745b7f6361fef469e2c4e8b6226924b55201adca79c6279f20e9cf4283e0f9595aad9ac6dfe602f7  py3-setuptools-rust-1.10.2.tar.gz
"
