# Contributor: Elizabeth Jennifer Myers <elizabeth@sporksirc.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-greenlet
pkgver=3.0.3
pkgrel=1
pkgdesc="Lightweight in-process concurrent programming"
url="https://pypi.org/project/greenlet"
arch="all"
license="MIT"
makedepends="py3-setuptools python3-dev py3-gpep517 py3-wheel"
checkdepends="py3-objgraph py3-psutil"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/g/greenlet/greenlet-$pkgver.tar.gz"
builddir="$srcdir/greenlet-$pkgver"

replaces="py-greenlet" # Backwards compatibility
provides="py-greenlet=$pkgver-r$pkgrel" # Backwards compatibility

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 unittest discover -v greenlet.tests
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	rm -r "$pkgdir"/usr/lib/python3*/site-packages/greenlet/tests/
}

sha512sums="
20d8818376a200332cbc2c85968317ddf828d2adf3fcc3c53623cd1504ec9a4e4e987e841bd2fe65e934e2b8a5e73a7205847526f0bd196e7afcdf3ae40e9d9b  greenlet-3.0.3.tar.gz
"
