1 |
commit: c2d15a210f6ce13cd4673222bad4d365da6dcdad |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon May 9 18:12:34 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon May 9 20:34:07 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c2d15a21 |
7 |
|
8 |
dev-python/pexpect: Enable py3.11 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/pexpect/files/pexpect-4.8.0-py311.patch | 67 ++++++++++++++++++++++ |
13 |
dev-python/pexpect/pexpect-4.8.0-r3.ebuild | 3 +- |
14 |
2 files changed, 69 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/dev-python/pexpect/files/pexpect-4.8.0-py311.patch b/dev-python/pexpect/files/pexpect-4.8.0-py311.patch |
17 |
new file mode 100644 |
18 |
index 000000000000..b7de17a68785 |
19 |
--- /dev/null |
20 |
+++ b/dev-python/pexpect/files/pexpect-4.8.0-py311.patch |
21 |
@@ -0,0 +1,67 @@ |
22 |
+From 52af5b0ae0627139524448a3f2e83d9f40802bc2 Mon Sep 17 00:00:00 2001 |
23 |
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@×××××××.cz> |
24 |
+Date: Thu, 24 Mar 2022 15:15:33 +0100 |
25 |
+Subject: [PATCH] Convert @asyncio.coroutine to async def |
26 |
+ |
27 |
+This is required for Python 3.11+ support. |
28 |
+ |
29 |
+Fixes https://github.com/pexpect/pexpect/issues/677 |
30 |
+--- |
31 |
+ pexpect/_async.py | 16 +++++++--------- |
32 |
+ 1 file changed, 7 insertions(+), 9 deletions(-) |
33 |
+ |
34 |
+diff --git a/pexpect/_async.py b/pexpect/_async.py |
35 |
+index dfbfeef5..bc83261d 100644 |
36 |
+--- a/pexpect/_async.py |
37 |
++++ b/pexpect/_async.py |
38 |
+@@ -4,8 +4,7 @@ |
39 |
+ |
40 |
+ from pexpect import EOF |
41 |
+ |
42 |
+-@×××××××.coroutine |
43 |
+-def expect_async(expecter, timeout=None): |
44 |
++async def expect_async(expecter, timeout=None): |
45 |
+ # First process data that was previously read - if it maches, we don't need |
46 |
+ # async stuff. |
47 |
+ idx = expecter.existing_data() |
48 |
+@@ -14,7 +13,7 @@ def expect_async(expecter, timeout=None): |
49 |
+ if not expecter.spawn.async_pw_transport: |
50 |
+ pw = PatternWaiter() |
51 |
+ pw.set_expecter(expecter) |
52 |
+- transport, pw = yield from asyncio.get_event_loop()\ |
53 |
++ transport, pw = await asyncio.get_event_loop()\ |
54 |
+ .connect_read_pipe(lambda: pw, expecter.spawn) |
55 |
+ expecter.spawn.async_pw_transport = pw, transport |
56 |
+ else: |
57 |
+@@ -22,26 +21,25 @@ def expect_async(expecter, timeout=None): |
58 |
+ pw.set_expecter(expecter) |
59 |
+ transport.resume_reading() |
60 |
+ try: |
61 |
+- return (yield from asyncio.wait_for(pw.fut, timeout)) |
62 |
++ return (await asyncio.wait_for(pw.fut, timeout)) |
63 |
+ except asyncio.TimeoutError as e: |
64 |
+ transport.pause_reading() |
65 |
+ return expecter.timeout(e) |
66 |
+ |
67 |
+-@×××××××.coroutine |
68 |
+-def repl_run_command_async(repl, cmdlines, timeout=-1): |
69 |
++async def repl_run_command_async(repl, cmdlines, timeout=-1): |
70 |
+ res = [] |
71 |
+ repl.child.sendline(cmdlines[0]) |
72 |
+ for line in cmdlines[1:]: |
73 |
+- yield from repl._expect_prompt(timeout=timeout, async_=True) |
74 |
++ await repl._expect_prompt(timeout=timeout, async_=True) |
75 |
+ res.append(repl.child.before) |
76 |
+ repl.child.sendline(line) |
77 |
+ |
78 |
+ # Command was fully submitted, now wait for the next prompt |
79 |
+- prompt_idx = yield from repl._expect_prompt(timeout=timeout, async_=True) |
80 |
++ prompt_idx = await repl._expect_prompt(timeout=timeout, async_=True) |
81 |
+ if prompt_idx == 1: |
82 |
+ # We got the continuation prompt - command was incomplete |
83 |
+ repl.child.kill(signal.SIGINT) |
84 |
+- yield from repl._expect_prompt(timeout=1, async_=True) |
85 |
++ await repl._expect_prompt(timeout=1, async_=True) |
86 |
+ raise ValueError("Continuation prompt found - input was incomplete:") |
87 |
+ return u''.join(res + [repl.child.before]) |
88 |
+ |
89 |
|
90 |
diff --git a/dev-python/pexpect/pexpect-4.8.0-r3.ebuild b/dev-python/pexpect/pexpect-4.8.0-r3.ebuild |
91 |
index 22046e4dcd82..67a37a70dcc5 100644 |
92 |
--- a/dev-python/pexpect/pexpect-4.8.0-r3.ebuild |
93 |
+++ b/dev-python/pexpect/pexpect-4.8.0-r3.ebuild |
94 |
@@ -4,7 +4,7 @@ |
95 |
EAPI=8 |
96 |
|
97 |
DISTUTILS_USE_PEP517=setuptools |
98 |
-PYTHON_COMPAT=( python3_{8..10} pypy3 ) |
99 |
+PYTHON_COMPAT=( python3_{8..11} pypy3 ) |
100 |
PYTHON_REQ_USE="threads(+)" |
101 |
|
102 |
inherit distutils-r1 |
103 |
@@ -29,6 +29,7 @@ RDEPEND=" |
104 |
PATCHES=( |
105 |
"${FILESDIR}"/${P}-sphinx-3.patch |
106 |
"${FILESDIR}"/${P}-fix-PS1.patch |
107 |
+ "${FILESDIR}"/${P}-py311.patch |
108 |
) |
109 |
|
110 |
distutils_enable_tests pytest |