summaryrefslogtreecommitdiff
path: root/dev-python/pexpect
diff options
context:
space:
mode:
authorroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
committerroot <root@alpha.trunkmasters.com>2026-06-12 19:09:37 -0500
commitb590c8d7572b727d565cc0b8ff660d43569845de (patch)
tree06f7a4102ea4e845df8b66660f252920d52952f9 /dev-python/pexpect
parent24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff)
downloadbaldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip
Adding metadataHEADdevelop
Diffstat (limited to 'dev-python/pexpect')
-rw-r--r--dev-python/pexpect/Manifest1
-rw-r--r--dev-python/pexpect/files/pexpect-4.9.0-py313.patch37
-rw-r--r--dev-python/pexpect/files/pexpect-4.9.0-py314.patch107
-rw-r--r--dev-python/pexpect/metadata.xml10
-rw-r--r--dev-python/pexpect/pexpect-4.9.0.ebuild65
5 files changed, 220 insertions, 0 deletions
diff --git a/dev-python/pexpect/Manifest b/dev-python/pexpect/Manifest
new file mode 100644
index 000000000000..13443088b210
--- /dev/null
+++ b/dev-python/pexpect/Manifest
@@ -0,0 +1 @@
+DIST pexpect-4.9.0.tar.gz 166450 BLAKE2B a08e10deb9f21e49a04021d78dc1ff6c9eeded5825ef73b236c3dac725e6877a4fe74deaa6844c8aa4b1beab4b915d7612e682529c4ed97b364a737a1960b30f SHA512 0e4b3a6978b94aee221ff23cd7bd771517e0e0f1a1a8b17f77f15bf78edd3130ad093d925b7d1e86fe6ba7eb956205d4c616b4e52b2fcfa1e944d4860dd7b3a0
diff --git a/dev-python/pexpect/files/pexpect-4.9.0-py313.patch b/dev-python/pexpect/files/pexpect-4.9.0-py313.patch
new file mode 100644
index 000000000000..838cfdd22d86
--- /dev/null
+++ b/dev-python/pexpect/files/pexpect-4.9.0-py313.patch
@@ -0,0 +1,37 @@
+From 95d09c54d2502d8d48f2da591089ceb6d09df056 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Wed, 29 May 2024 12:21:52 +0200
+Subject: [PATCH] Force NO_COLOR=1 to fix test failures with Python 3.13+ REPL
+
+Python 3.13+ has colors now. Always setting this variable should be safe.
+---
+ pexpect/replwrap.py | 2 +-
+ tests/test_replwrap.py | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pexpect/replwrap.py b/pexpect/replwrap.py
+index 08dbd5e8..c8714a23 100644
+--- a/pexpect/replwrap.py
++++ b/pexpect/replwrap.py
+@@ -35,7 +35,7 @@ def __init__(self, cmd_or_spawn, orig_prompt, prompt_change,
+ continuation_prompt=PEXPECT_CONTINUATION_PROMPT,
+ extra_init_cmd=None):
+ if isinstance(cmd_or_spawn, basestring):
+- self.child = pexpect.spawn(cmd_or_spawn, echo=False, encoding='utf-8')
++ self.child = pexpect.spawn(cmd_or_spawn, echo=False, encoding='utf-8', env={'NO_COLOR': '1'})
+ else:
+ self.child = cmd_or_spawn
+ if self.child.echo:
+diff --git a/tests/test_replwrap.py b/tests/test_replwrap.py
+index ddafa5d6..5ac782a4 100644
+--- a/tests/test_replwrap.py
++++ b/tests/test_replwrap.py
+@@ -124,7 +124,7 @@ def test_no_change_prompt(self):
+ if platform.python_implementation() == 'PyPy':
+ raise unittest.SkipTest(skip_pypy)
+
+- child = pexpect.spawn(sys.executable, echo=False, timeout=5, encoding='utf-8')
++ child = pexpect.spawn(sys.executable, echo=False, timeout=5, encoding='utf-8', env={'NO_COLOR': '1'})
+ # prompt_change=None should mean no prompt change
+ py = replwrap.REPLWrapper(child, u">>> ", prompt_change=None,
+ continuation_prompt=u"... ")
diff --git a/dev-python/pexpect/files/pexpect-4.9.0-py314.patch b/dev-python/pexpect/files/pexpect-4.9.0-py314.patch
new file mode 100644
index 000000000000..a7d1f8f83593
--- /dev/null
+++ b/dev-python/pexpect/files/pexpect-4.9.0-py314.patch
@@ -0,0 +1,107 @@
+https://github.com/pexpect/pexpect/commit/456bc10d94b57e254568e7ea9a8b3cffb856ebff
+
+From 456bc10d94b57e254568e7ea9a8b3cffb856ebff Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Fri, 22 Nov 2024 16:41:55 +0100
+Subject: [PATCH] Tests: Avoid the multiprocessing forkserver method
+
+Fixes https://github.com/pexpect/pexpect/issues/807
+---
+ tests/test_expect.py | 12 ++++++++++--
+ tests/test_socket.py | 24 ++++++++++++++++--------
+ 2 files changed, 26 insertions(+), 10 deletions(-)
+
+diff --git a/tests/test_expect.py b/tests/test_expect.py
+index c16e0551..fb1e30e2 100755
+--- a/tests/test_expect.py
++++ b/tests/test_expect.py
+@@ -33,6 +33,14 @@
+
+ PY3 = bool(sys.version_info.major >= 3)
+
++# Python 3.14 changed the non-macOS POSIX default to forkserver
++# but the code in this module does not work with it
++# See https://github.com/python/cpython/issues/125714
++if multiprocessing.get_start_method() == 'forkserver':
++ mp_context = multiprocessing.get_context(method='fork')
++else:
++ mp_context = multiprocessing.get_context()
++
+ # Many of these test cases blindly assume that sequential directory
+ # listings of the /bin directory will yield the same results.
+ # This may not be true, but seems adequate for testing now.
+@@ -682,7 +690,7 @@ def test_stdin_closed(self):
+ '''
+ Ensure pexpect continues to operate even when stdin is closed
+ '''
+- class Closed_stdin_proc(multiprocessing.Process):
++ class Closed_stdin_proc(mp_context.Process):
+ def run(self):
+ sys.__stdin__.close()
+ cat = pexpect.spawn('cat')
+@@ -698,7 +706,7 @@ def test_stdin_stdout_closed(self):
+ '''
+ Ensure pexpect continues to operate even when stdin and stdout is closed
+ '''
+- class Closed_stdin_stdout_proc(multiprocessing.Process):
++ class Closed_stdin_stdout_proc(mp_context.Process):
+ def run(self):
+ sys.__stdin__.close()
+ sys.__stdout__.close()
+diff --git a/tests/test_socket.py b/tests/test_socket.py
+index b801b00a..6521d368 100644
+--- a/tests/test_socket.py
++++ b/tests/test_socket.py
+@@ -29,6 +29,14 @@
+ import time
+ import errno
+
++# Python 3.14 changed the non-macOS POSIX default to forkserver
++# but the code in this module does not work with it
++# See https://github.com/python/cpython/issues/125714
++if multiprocessing.get_start_method() == 'forkserver':
++ mp_context = multiprocessing.get_context(method='fork')
++else:
++ mp_context = multiprocessing.get_context()
++
+
+ class SocketServerError(Exception):
+ pass
+@@ -83,8 +91,8 @@ def setUp(self):
+ self.prompt3 = b'Press X to exit:'
+ self.enter = b'\r\n'
+ self.exit = b'X\r\n'
+- self.server_up = multiprocessing.Event()
+- self.server_process = multiprocessing.Process(target=self.socket_server, args=(self.server_up,))
++ self.server_up = mp_context.Event()
++ self.server_process = mp_context.Process(target=self.socket_server, args=(self.server_up,))
+ self.server_process.daemon = True
+ self.server_process.start()
+ counter = 0
+@@ -189,9 +197,9 @@ def test_timeout(self):
+ session.expect(b'Bogus response')
+
+ def test_interrupt(self):
+- timed_out = multiprocessing.Event()
+- all_read = multiprocessing.Event()
+- test_proc = multiprocessing.Process(target=self.socket_fn, args=(timed_out, all_read))
++ timed_out = mp_context.Event()
++ all_read = mp_context.Event()
++ test_proc = mp_context.Process(target=self.socket_fn, args=(timed_out, all_read))
+ test_proc.daemon = True
+ test_proc.start()
+ while not all_read.is_set():
+@@ -203,9 +211,9 @@ def test_interrupt(self):
+ self.assertEqual(test_proc.exitcode, errno.ETIMEDOUT)
+
+ def test_multiple_interrupts(self):
+- timed_out = multiprocessing.Event()
+- all_read = multiprocessing.Event()
+- test_proc = multiprocessing.Process(target=self.socket_fn, args=(timed_out, all_read))
++ timed_out = mp_context.Event()
++ all_read = mp_context.Event()
++ test_proc = mp_context.Process(target=self.socket_fn, args=(timed_out, all_read))
+ test_proc.daemon = True
+ test_proc.start()
+ while not all_read.is_set():
+
diff --git a/dev-python/pexpect/metadata.xml b/dev-python/pexpect/metadata.xml
new file mode 100644
index 000000000000..5e95859f915a
--- /dev/null
+++ b/dev-python/pexpect/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <stabilize-allarches />
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>
diff --git a/dev-python/pexpect/pexpect-4.9.0.ebuild b/dev-python/pexpect/pexpect-4.9.0.ebuild
new file mode 100644
index 000000000000..cc7068ae0eea
--- /dev/null
+++ b/dev-python/pexpect/pexpect-4.9.0.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{13..14} )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1 pypi
+
+DESCRIPTION="Python module for spawning child apps and responding to expected patterns"
+HOMEPAGE="
+ https://pexpect.readthedocs.io/
+ https://pypi.org/project/pexpect/
+ https://github.com/pexpect/pexpect/
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos"
+IUSE="examples"
+
+RDEPEND="
+ >=dev-python/ptyprocess-0.5[${PYTHON_USEDEP}]
+"
+
+EPYTEST_PLUGINS=()
+distutils_enable_tests pytest
+distutils_enable_sphinx doc \
+ dev-python/sphinxcontrib-github-alt
+
+EPYTEST_DESELECT=(
+ # flaky test on weaker arches
+ tests/test_performance.py
+ # requires zsh installed, not worth it
+ tests/test_replwrap.py::REPLWrapTestCase::test_zsh
+ # flaky
+ tests/test_env.py::TestCaseEnv::test_spawn_uses_env
+ # flaky & hangy
+ tests/test_socket.py::ExpectTestCase::test_interrupt
+)
+
+PATCHES=(
+ # https://github.com/pexpect/pexpect/pull/794
+ "${FILESDIR}/${P}-py313.patch"
+ # https://github.com/pexpect/pexpect/pull/808
+ "${FILESDIR}/${P}-py314.patch"
+)
+
+src_test() {
+ # workaround new readline defaults
+ echo "set enable-bracketed-paste off" > "${T}"/inputrc || die
+ local -x INPUTRC="${T}"/inputrc
+
+ distutils-r1_src_test
+}
+
+python_install_all() {
+ if use examples; then
+ dodoc -r examples
+ docompress -x /usr/share/doc/${PF}/examples
+ fi
+ distutils-r1_python_install_all
+}