diff --git a/community/py3-anyio/APKBUILD b/community/py3-anyio/APKBUILD index b53ab669ea4..0952a3cc318 100644 --- a/community/py3-anyio/APKBUILD +++ b/community/py3-anyio/APKBUILD @@ -1,41 +1,48 @@ # Contributor: Michał Polański # Maintainer: Michał Polański pkgname=py3-anyio -pkgver=3.6.2 -pkgrel=3 +pkgver=4.3.0 +pkgrel=1 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-setuptools py3-setuptools_scm" +makedepends="py3-gpep517 py3-setuptools py3-wheel py3-pytest-xdist" # change this when 4.x releases and upgrade py3-trio -checkdepends="py3-pytest py3-pytest-mock py3-hypothesis py3-trustme py3-trio<0.22 py3-uvloop" +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" +source="https://github.com/agronholm/anyio/archive/$pkgver/py3-anyio-$pkgver.tar.gz + test-excgroup.patch" builddir="$srcdir/anyio-$pkgver" -# https://github.com/agronholm/anyio/issues/550 -options="!check" - -export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver build() { - python3 setup.py build + gpep517 build-wheel \ + --wheel-dir .dist \ + --output-fd 3 3>&1 >&2 } check() { - python3 setup.py install --root="$PWD/test_install" --skip-build - - # Behavior of getaddrinfo differs between event loop implementations - # on musl-based systems - PYTHONPATH="$(echo $PWD/test_install/usr/lib/python3*/site-packages)" pytest \ - --deselect tests/test_sockets.py::test_getaddrinfo_ipv6addr + 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 setup.py install --root="$pkgdir" --skip-build + python3 -m installer -d "$pkgdir" .dist/*.whl } sha512sums=" -4a0d3dd11393bd3d7a99d3365825df14d70fa14fa6ddf0e3f9eb9affcde7a9ac1f9e5ba38d6ac9b7f246ba9e7d4bea0dd9c8049f1dc8beadbe6b4b803571fc21 py3-anyio-3.6.2.tar.gz +f069a2feb6464a429eb24921969eb13cf92f0c6bfb6b3a3b0b770c54621a7c663343267e7df7444c74b26643002b24bd7ce4df8a9e0662a38def2ec5a6f1d54c py3-anyio-4.3.0.tar.gz +7785e7d730cb83bf112340cf043324b2b5873cfe21e87906977aed275bc0fe99cce232dae7311299b8055c4681023d75851884e567d53a984826483dfc3f6139 test-excgroup.patch " diff --git a/community/py3-anyio/test-excgroup.patch b/community/py3-anyio/test-excgroup.patch new file mode 100644 index 00000000000..eabadc60396 --- /dev/null +++ b/community/py3-anyio/test-excgroup.patch @@ -0,0 +1,32 @@ +Since exceptiongroup is not packaged in Alpine, rewrite test using +native Python 3.11+ syntax. + +diff --git a/tests/test_taskgroups.py b/tests/test_taskgroups.py +index 2280b65..3ae6f4b 100644 +--- a/tests/test_taskgroups.py ++++ b/tests/test_taskgroups.py +@@ -8,7 +8,6 @@ from collections.abc import AsyncGenerator, Coroutine, Generator + from typing import Any, NoReturn, cast + + import pytest +-from exceptiongroup import catch + + import anyio + from anyio import ( +@@ -1304,13 +1303,12 @@ async def test_cancel_before_entering_task_group() -> None: + + + async def test_reraise_cancelled_in_excgroup() -> None: +- def handler(excgrp: BaseExceptionGroup) -> None: +- raise +- + with CancelScope() as scope: + scope.cancel() +- with catch({get_cancelled_exc_class(): handler}): ++ try: + await anyio.sleep_forever() ++ except* get_cancelled_exc_class(): ++ raise + + + async def test_cancel_child_task_when_host_is_shielded() -> None: