# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=py3-anyio
pkgver=4.3.0
pkgrel=2
pkgdesc="High level compatibility layer for multiple asynchronous event loop implementations"
url="https://github.com/agronholm/anyio"
license="MIT"
arch="noarch"
depends="python3 py3-idna py3-sniffio"
makedepends="py3-gpep517 py3-setuptools py3-wheel py3-pytest-xdist"
# change this when 4.x releases and upgrade py3-trio
checkdepends="
	py3-hypothesis
	py3-psutil
	py3-pytest
	py3-pytest-mock
	py3-trio
	py3-trustme
	py3-uvloop
	"
subpackages="$pkgname-pyc"
source="https://github.com/agronholm/anyio/archive/$pkgver/py3-anyio-$pkgver.tar.gz
	test-excgroup.patch"
builddir="$srcdir/anyio-$pkgver"

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
	# disable tests that requires network
	.testenv/bin/python3 -m pytest -n auto \
		--ignore tests/test_sockets.py
}

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

sha512sums="
f069a2feb6464a429eb24921969eb13cf92f0c6bfb6b3a3b0b770c54621a7c663343267e7df7444c74b26643002b24bd7ce4df8a9e0662a38def2ec5a6f1d54c  py3-anyio-4.3.0.tar.gz
7785e7d730cb83bf112340cf043324b2b5873cfe21e87906977aed275bc0fe99cce232dae7311299b8055c4681023d75851884e567d53a984826483dfc3f6139  test-excgroup.patch
"
