summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2023-03-09 18:17:52 +0100
committerMichał Górny <mgorny@gentoo.org>2023-03-09 19:17:40 +0100
commitb0e6740a8a6b1266051abdfaa90d2591672aaf1d (patch)
treecb5a84185c18692b4483f8e6806f96ebc758ce43 /dev-python/trio-websocket
parentdev-lang/zig: sync live (diff)
downloadgentoo-b0e6740a8a6b1266051abdfaa90d2591672aaf1d.tar.gz
gentoo-b0e6740a8a6b1266051abdfaa90d2591672aaf1d.tar.bz2
gentoo-b0e6740a8a6b1266051abdfaa90d2591672aaf1d.zip
dev-python/trio-websocket: New package, v0.9.2
New dependency of dev-python/selenium. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/trio-websocket')
-rw-r--r--dev-python/trio-websocket/Manifest1
-rw-r--r--dev-python/trio-websocket/files/trio-websocket-0.9.2-async-gen.patch79
-rw-r--r--dev-python/trio-websocket/metadata.xml13
-rw-r--r--dev-python/trio-websocket/trio-websocket-0.9.2.ebuild47
4 files changed, 140 insertions, 0 deletions
diff --git a/dev-python/trio-websocket/Manifest b/dev-python/trio-websocket/Manifest
new file mode 100644
index 000000000000..1f25a757c7ef
--- /dev/null
+++ b/dev-python/trio-websocket/Manifest
@@ -0,0 +1 @@
+DIST trio-websocket-0.9.2.gh.tar.gz 43146 BLAKE2B f5463d20253c3686a0d0fe4cb38ffec235c4378c14ed2952b3518486602b06bb961291d098542a52dee7e25506713df382e303cd2dc7fa579041124d66c8ecb8 SHA512 0f25a7d234a6d9f7c0c0bdbbd2836e6baee02b4ff2daab8354f8fd483a10de65fe357a273675a172227b1b0e9f7cf6cf27ddfdf9426d1b330122a8b2ef957435
diff --git a/dev-python/trio-websocket/files/trio-websocket-0.9.2-async-gen.patch b/dev-python/trio-websocket/files/trio-websocket-0.9.2-async-gen.patch
new file mode 100644
index 000000000000..7631e2118678
--- /dev/null
+++ b/dev-python/trio-websocket/files/trio-websocket-0.9.2-async-gen.patch
@@ -0,0 +1,79 @@
+From 37388d8122960f6aec707a9aa30a310bdc67610a Mon Sep 17 00:00:00 2001
+From: John Belmonte <john@neggie.net>
+Date: Sat, 21 Nov 2020 15:38:54 +0900
+Subject: [PATCH] use native async generator support
+
+---
+ tests/test_connection.py | 7 ++-----
+ trio_websocket/_impl.py | 5 ++---
+ 2 files changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/tests/test_connection.py b/tests/test_connection.py
+index 8af07a9..7832355 100644
+--- a/tests/test_connection.py
++++ b/tests/test_connection.py
+@@ -37,7 +37,6 @@
+ import pytest
+ import trio
+ import trustme
+-from async_generator import async_generator, yield_
+ from trio.testing import memory_stream_pair
+ from wsproto.events import CloseConnection
+
+@@ -78,24 +77,22 @@
+
+
+ @pytest.fixture
+-@async_generator
+ async def echo_server(nursery):
+ ''' A server that reads one message, sends back the same message,
+ then closes the connection. '''
+ serve_fn = partial(serve_websocket, echo_request_handler, HOST, 0,
+ ssl_context=None)
+ server = await nursery.start(serve_fn)
+- await yield_(server)
++ yield server
+
+
+ @pytest.fixture
+-@async_generator
+ async def echo_conn(echo_server):
+ ''' Return a client connection instance that is connected to an echo
+ server. '''
+ async with open_websocket(HOST, echo_server.port, RESOURCE,
+ use_ssl=False) as conn:
+- await yield_(conn)
++ yield conn
+
+
+ async def echo_request_handler(request):
+diff --git a/trio_websocket/_impl.py b/trio_websocket/_impl.py
+index 693c379..440d0e2 100644
+--- a/trio_websocket/_impl.py
++++ b/trio_websocket/_impl.py
+@@ -9,7 +9,7 @@
+ import struct
+ import urllib.parse
+
+-from async_generator import async_generator, yield_, asynccontextmanager
++from async_generator import asynccontextmanager
+ import trio
+ import trio.abc
+ from wsproto import ConnectionType, WSConnection
+@@ -65,7 +65,6 @@ def remove_cancels(exc):
+
+
+ @asynccontextmanager
+-@async_generator
+ async def open_websocket(host, port, resource, *, use_ssl, subprotocols=None,
+ extra_headers=None,
+ message_queue_size=MESSAGE_QUEUE_SIZE, max_message_size=MAX_MESSAGE_SIZE,
+@@ -115,7 +114,7 @@ async def open_websocket(host, port, resource, *, use_ssl, subprotocols=None,
+ except OSError as e:
+ raise HandshakeError from e
+ try:
+- await yield_(connection)
++ yield connection
+ finally:
+ try:
+ with trio.fail_after(disconnect_timeout):
diff --git a/dev-python/trio-websocket/metadata.xml b/dev-python/trio-websocket/metadata.xml
new file mode 100644
index 000000000000..f92b85725b72
--- /dev/null
+++ b/dev-python/trio-websocket/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <stabilize-allarches/>
+ <upstream>
+ <remote-id type="github">HyperionGray/trio-websocket</remote-id>
+ <remote-id type="pypi">trio-websocket</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-python/trio-websocket/trio-websocket-0.9.2.ebuild b/dev-python/trio-websocket/trio-websocket-0.9.2.ebuild
new file mode 100644
index 000000000000..c0129ead5201
--- /dev/null
+++ b/dev-python/trio-websocket/trio-websocket-0.9.2.ebuild
@@ -0,0 +1,47 @@
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( pypy3 python3_{9..11} )
+
+inherit distutils-r1
+
+DESCRIPTION="WebSocket client and server implementation for Python Trio"
+HOMEPAGE="
+ https://github.com/HyperionGray/trio-websocket/
+ https://pypi.org/project/trio-websocket/
+"
+SRC_URI="
+ https://github.com/HyperionGray/trio-websocket/archive/${PV}.tar.gz
+ -> ${P}.gh.tar.gz
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+ >=dev-python/async_generator-1.10[${PYTHON_USEDEP}]
+ >=dev-python/trio-0.11[${PYTHON_USEDEP}]
+ >=dev-python/wsproto-0.14[${PYTHON_USEDEP}]
+"
+BDEPEND="
+ test? (
+ >=dev-python/pytest-trio-0.5.0[${PYTHON_USEDEP}]
+ dev-python/trustme[${PYTHON_USEDEP}]
+ )
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+ # backport from https://github.com/HyperionGray/trio-websocket/pull/138/
+ "${FILESDIR}"/${P}-async-gen.patch
+)
+
+python_test() {
+ local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ epytest -p trio
+}