summaryrefslogtreecommitdiff
path: root/dev-python/twisted/files
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/twisted/files
parent24f9cbfc4c34fdb6a6e03311674414e881ceab47 (diff)
downloadbaldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.gz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.tar.xz
baldeagleos-repo-b590c8d7572b727d565cc0b8ff660d43569845de.zip
Adding metadata
Diffstat (limited to 'dev-python/twisted/files')
-rw-r--r--dev-python/twisted/files/twistd.conf7
-rw-r--r--dev-python/twisted/files/twistd.init25
-rw-r--r--dev-python/twisted/files/twisted-25.5.0-py314.patch26
-rw-r--r--dev-python/twisted/files/twisted-25.5.0-rebuild.patch41
-rw-r--r--dev-python/twisted/files/twisted-26.4.0-py314.patch43
5 files changed, 142 insertions, 0 deletions
diff --git a/dev-python/twisted/files/twistd.conf b/dev-python/twisted/files/twistd.conf
new file mode 100644
index 000000000000..53788cd0017e
--- /dev/null
+++ b/dev-python/twisted/files/twistd.conf
@@ -0,0 +1,7 @@
+
+# These are passed to twistd.
+# TWISTD_OPTS="--no_save --logfile=/var/log/twistd -y /etc/twistd.tac"
+# TWISTD_OPTS="--no_save --logfile=/var/log/twistd -f /etc/twistd.tap"
+
+# Make any additions to PYTHONPATH the twistd needs here.
+# PYTHONPATH="/path/to/extra/python/modules"
diff --git a/dev-python/twisted/files/twistd.init b/dev-python/twisted/files/twistd.init
new file mode 100644
index 000000000000..b031b0020c6e
--- /dev/null
+++ b/dev-python/twisted/files/twistd.init
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+
+depend() {
+ need net
+}
+
+start() {
+ if [ -z "${TWISTD_OPTS}" ]; then
+ eerror "TWISTD_OPTS is not set!"
+ eerror "You need to configure twistd in /etc/conf.d/twistd."
+ return 1
+ fi
+ export PYTHONPATH
+ ebegin "Starting twistd"
+ start-stop-daemon --start --quiet --pidfile /var/run/twistd.pid \
+ --exec /usr/bin/twistd -- --pidfile /var/run/twistd.pid \
+ ${TWISTD_OPTS}
+ eend $? "Failed to start twistd"
+}
+
+stop() {
+ ebegin "Stopping twistd"
+ start-stop-daemon --stop --quiet --pidfile /var/run/twistd.pid
+ eend $? "Failed to stop twistd"
+}
diff --git a/dev-python/twisted/files/twisted-25.5.0-py314.patch b/dev-python/twisted/files/twisted-25.5.0-py314.patch
new file mode 100644
index 000000000000..88bb87360bcb
--- /dev/null
+++ b/dev-python/twisted/files/twisted-25.5.0-py314.patch
@@ -0,0 +1,26 @@
+diff --git a/src/twisted/internet/asyncioreactor.py b/src/twisted/internet/asyncioreactor.py
+index cd1cf65f05d..03b2d8ecb24 100644
+--- a/src/twisted/internet/asyncioreactor.py
++++ b/src/twisted/internet/asyncioreactor.py
+@@ -9,7 +9,7 @@
+
+ import errno
+ import sys
+-from asyncio import AbstractEventLoop, get_event_loop
++from asyncio import AbstractEventLoop, get_running_loop, new_event_loop, set_event_loop
+ from typing import Dict, Optional, Type
+
+ from zope.interface import implementer
+@@ -47,7 +47,11 @@ class AsyncioSelectorReactor(PosixReactorBase):
+
+ def __init__(self, eventloop: Optional[AbstractEventLoop] = None):
+ if eventloop is None:
+- _eventloop: AbstractEventLoop = get_event_loop()
++ try:
++ _eventloop: AbstractEventLoop = get_running_loop()
++ except RuntimeError:
++ _eventloop = new_event_loop()
++ set_event_loop(_eventloop)
+ else:
+ _eventloop = eventloop
+
diff --git a/dev-python/twisted/files/twisted-25.5.0-rebuild.patch b/dev-python/twisted/files/twisted-25.5.0-rebuild.patch
new file mode 100644
index 000000000000..e92595c7649e
--- /dev/null
+++ b/dev-python/twisted/files/twisted-25.5.0-rebuild.patch
@@ -0,0 +1,41 @@
+From bd88d363bc9aa985131a9c2bb06ab37497e33173 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 25 May 2025 18:53:56 +0200
+Subject: [PATCH] Fix `rebuild()` to handle changing `sys.modules` gracefully
+
+Copy keys from `sys.modules` before starting to iterate over it
+in the `rebuild()` function, and handle missing modules gracefully,
+in order to fix possible "directionary changed size during iteration"
+errors. In particular, this can happen when iterating over the `py`
+module.
+
+Fixes #12458
+---
+ src/twisted/newsfragments/12458.bugfix | 1 +
+ src/twisted/python/rebuild.py | 5 ++++-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+ create mode 100644 src/twisted/newsfragments/12458.bugfix
+
+diff --git a/src/twisted/newsfragments/12458.bugfix b/src/twisted/newsfragments/12458.bugfix
+new file mode 100644
+index 00000000000..df61eb384af
+--- /dev/null
++++ b/src/twisted/newsfragments/12458.bugfix
+@@ -0,0 +1 @@
++twisted.python.rebuild.rebuild() now handles changes to ``sys.modules`` gracefully. Prior to the change, it could possibly raise a "dictionary changed size during iteration" error if the module list changed.
+diff --git a/src/twisted/python/rebuild.py b/src/twisted/python/rebuild.py
+index e82beec1b6a..4ab7e0533d0 100644
+--- a/src/twisted/python/rebuild.py
++++ b/src/twisted/python/rebuild.py
+@@ -210,7 +210,10 @@ def rebuild(module, doLog=1):
+ log.msg("")
+ log.msg(f" (fixing {str(module.__name__)}): ")
+ modcount = 0
+- for mk, mod in sys.modules.items():
++ # note: sys.modules can change throughout iteration
++ # https://github.com/twisted/twisted/issues/12458
++ for mk in list(sys.modules):
++ mod = sys.modules.get(mk)
+ modcount = modcount + 1
+ if mod == module or mod is None:
+ continue
diff --git a/dev-python/twisted/files/twisted-26.4.0-py314.patch b/dev-python/twisted/files/twisted-26.4.0-py314.patch
new file mode 100644
index 000000000000..e9c806e8a930
--- /dev/null
+++ b/dev-python/twisted/files/twisted-26.4.0-py314.patch
@@ -0,0 +1,43 @@
+diff --git a/src/twisted/internet/test/test_asyncioreactor.py b/src/twisted/internet/test/test_asyncioreactor.py
+index 2f7bad930d6..bbbb8c834ca 100644
+--- a/src/twisted/internet/test/test_asyncioreactor.py
++++ b/src/twisted/internet/test/test_asyncioreactor.py
+@@ -12,8 +12,8 @@
+ DefaultEventLoopPolicy,
+ Future,
+ SelectorEventLoop,
+- get_event_loop,
+ get_event_loop_policy,
++ get_running_loop,
+ set_event_loop,
+ set_event_loop_policy,
+ )
+@@ -74,14 +74,26 @@ def newLoop(self, policy: AbstractEventLoopPolicy) -> AbstractEventLoop:
+ Make a new asyncio loop from a policy for use with a reactor, and add
+ appropriate cleanup to restore any global state.
+ """
+- existingLoop = get_event_loop()
++ try:
++ existingLoop = get_running_loop()
++ except RuntimeError: # pragma: no branch
++ # For most runs, we should not have any existing loop,
++ # since the tests should leave a clean reactor.
++ # For some cases, like GTK tests,
++ # there might be a running reactor.
++ # To revert the state found at the start of the test
++ # we keep a reference and restore it later.
++ existingLoop = None
+ existingPolicy = get_event_loop_policy()
+ result = policy.new_event_loop()
+
+ @self.addCleanup
+ def cleanUp():
+ result.close()
+- set_event_loop(existingLoop)
++ if existingLoop is not None: # pragma: no cover
++ # Revert the loop found at the start of the test.
++ # See https://github.com/twisted/twisted/pull/11706
++ set_event_loop(existingLoop)
+ set_event_loop_policy(existingPolicy)
+
+ return result