From 4c3476a7536e9f7b9a5aed8a2837fec7b0399277 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Sat, 23 Sep 2023 21:03:26 -0400 Subject: [PATCH] python3-curio: rebuild for Python 3.12 --- .../python3-curio/patches/python3.12.patch | 70 +++++++++++++++++++ srcpkgs/python3-curio/template | 7 +- 2 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/python3-curio/patches/python3.12.patch diff --git a/srcpkgs/python3-curio/patches/python3.12.patch b/srcpkgs/python3-curio/patches/python3.12.patch new file mode 100644 index 00000000000..f6a6e5dfa1d --- /dev/null +++ b/srcpkgs/python3-curio/patches/python3.12.patch @@ -0,0 +1,70 @@ +From a5590bb04de3f1f201fd1fd0ce9cfe5825db80ac Mon Sep 17 00:00:00 2001 +From: Hugo van Kemenade +Date: Sun, 10 Sep 2023 21:38:09 +0300 +Subject: [PATCH 1/2] Add support for Python 3.12 + +--- + curio/channel.py | 13 ++++++++++--- + curio/ssl.py | 2 +- + 2 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/curio/channel.py b/curio/channel.py +index 230427fb..2a54952b 100644 +--- a/curio/channel.py ++++ b/curio/channel.py +@@ -28,9 +28,16 @@ + # Authentication parameters (copied from multiprocessing) + + AUTH_MESSAGE_LENGTH = mpc.MESSAGE_LENGTH # 20 +-CHALLENGE = mpc.CHALLENGE # b'#CHALLENGE#' +-WELCOME = mpc.WELCOME # b'#WELCOME#' +-FAILURE = mpc.FAILURE # b'#FAILURE#' ++try: ++ # Python 3.12+ ++ CHALLENGE = mpc._CHALLENGE # b'#CHALLENGE#' ++ WELCOME = mpc._WELCOME # b'#WELCOME#' ++ FAILURE = mpc._FAILURE # b'#FAILURE#' ++except AttributeError: ++ # Python 3.7-3.11 ++ CHALLENGE = mpc.CHALLENGE # b'#CHALLENGE#' ++ WELCOME = mpc.WELCOME # b'#WELCOME#' ++ FAILURE = mpc.FAILURE # b'#FAILURE#' + + + +diff --git a/curio/ssl.py b/curio/ssl.py +index 37efa081..12ba6a04 100644 +--- a/curio/ssl.py ++++ b/curio/ssl.py +@@ -27,7 +27,7 @@ class SSLWantWriteError(Exception): + from .io import Socket + + if _ssl: +- @wraps(_ssl.wrap_socket) ++ @wraps(_ssl.SSLContext.wrap_socket) + async def wrap_socket(sock, *args, do_handshake_on_connect=True, **kwargs): + if isinstance(sock, Socket): + sock = sock._socket + +From 379904c4ac8cd56c1f69aec2bdd2c78b9bd046eb Mon Sep 17 00:00:00 2001 +From: Hugo van Kemenade +Date: Mon, 11 Sep 2023 11:30:49 +0300 +Subject: [PATCH 2/2] Add support for Python 3.12 + +--- + curio/ssl.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/curio/ssl.py b/curio/ssl.py +index 12ba6a04..4619eb18 100644 +--- a/curio/ssl.py ++++ b/curio/ssl.py +@@ -32,7 +32,7 @@ async def wrap_socket(sock, *args, do_handshake_on_connect=True, **kwargs): + if isinstance(sock, Socket): + sock = sock._socket + +- ssl_sock = _ssl.wrap_socket(sock, *args, do_handshake_on_connect=False, **kwargs) ++ ssl_sock = _ssl.SSLContext.wrap_socket(sock, *args, do_handshake_on_connect=False, **kwargs) + cssl_sock = Socket(ssl_sock) + cssl_sock.do_handshake_on_connect = do_handshake_on_connect + if do_handshake_on_connect and ssl_sock._connected: diff --git a/srcpkgs/python3-curio/template b/srcpkgs/python3-curio/template index a712cbd3ad2..be09b67c70c 100644 --- a/srcpkgs/python3-curio/template +++ b/srcpkgs/python3-curio/template @@ -1,11 +1,11 @@ # Template file for 'python3-curio' pkgname=python3-curio version=1.6 -revision=1 +revision=2 build_style=python3-module hostmakedepends="python3-setuptools" depends="python3" -checkdepends="python3-pytest" +checkdepends="python3-pytest-xdist" short_desc="Coroutine-based library for concurrent programming using async/await" maintainer="Arjan Mossel " license="BSD-3-Clause" @@ -17,7 +17,8 @@ checksum=8bf9f1fa8b16f8f9f202c9c7d7189f3757ecc38e3823a0afa363b59acb087123 do_check() { # CI container has different privileges than expected in test_errors() # which leads to CI builds timing out on some arches. - PYTHONPATH=$(cd build/lib* && pwd) pytest -k 'not test_errors' + PYTHONPATH=$(cd build/lib* && pwd) \ + pytest3 -n "${XBPS_MAKEJOBS}" -k 'not test_errors' } post_install() {