# Maintainer: Michael Zhou <zhoumichaely@gmail.com>
# Contributor: Michael Zhou <zhoumichaely@gmail.com>
pkgname=py3-gevent
pkgver=25.4.2
pkgrel=0
pkgdesc="Python3 library for seamless coroutine-based concurrency"
url="https://gevent.org/"
arch="all"
license="MIT"
depends="
	py3-cffi
	py3-greenlet
	py3-zope-event
	py3-zope-interface
	"
makedepends="
	c-ares-dev
	cython
	file
	libev-dev
	libevent-dev
	libuv-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="python3-tests py3-objgraph"
subpackages="$pkgname-pyc"
source="https://github.com/gevent/gevent/archive/$pkgver/gevent-$pkgver.tar.gz"
builddir="$srcdir/gevent-$pkgver"
options="!check" # tests fail

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

build() {
	export GEVENTSETUP_EMBED=0
	export GEVENTSETUP_EMBED_LIBEV=0
	export CFLAGS="$CFLAGS -Wno-incompatible-pointer-types"

	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/gevent*.whl
	.testenv/bin/python3 -m gevent.tests
}

package() {
	export GEVENTSETUP_EMBED=0
	export GEVENTSETUP_EMBED_LIBEV=0

	python3 -m installer -d "$pkgdir" \
		.dist/gevent*.whl

	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/*/tests
}

sha512sums="
19a1a900a88c7ed27799e8b7d3504e4fdff549b5fd7a978ff5142b4c97456f2c6bdecabcc30677e38a045d234e93cf926ce76715bd21dcc5ce17d8b4cc71dd10  gevent-25.4.2.tar.gz
"
