# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-regex
pkgver=2024.11.7
pkgrel=0
pkgdesc="More featureful implementation of the 're' module"
url="https://github.com/mrabarnett/mrab-regex"
arch="all"
license="Apache-2.0"
depends="python3"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mrabarnett/mrab-regex/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/mrab-regex-$pkgver"
options="!check" # fails to run

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
	cd .testenv
	bin/python3 ../regex_3/test_regex.py
}

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

	rm -v "$pkgdir"/usr/lib/python3*/site-packages/regex/test_regex.py
}

sha512sums="
8a24d2c520bf56eb1496ed8ad4e313b194f18c3e1839b9656775ae24a8c1ba950714fcf3e48b2782ec06f9e5b200ca898b0c5f426f2501e3dbf34fe1d3158b96  py3-regex-2024.11.7.tar.gz
"
