From b590c8d7572b727d565cc0b8ff660d43569845de Mon Sep 17 00:00:00 2001 From: root Date: Fri, 12 Jun 2026 19:09:37 -0500 Subject: Adding metadata --- dev-python/twisted/Manifest | 7 + dev-python/twisted/files/twistd.conf | 7 + dev-python/twisted/files/twistd.init | 25 +++ .../twisted/files/twisted-25.5.0-py314.patch | 26 ++++ .../twisted/files/twisted-25.5.0-rebuild.patch | 41 +++++ .../twisted/files/twisted-26.4.0-py314.patch | 43 ++++++ dev-python/twisted/metadata.xml | 29 ++++ dev-python/twisted/twisted-25.5.0-r1.ebuild | 171 ++++++++++++++++++++ dev-python/twisted/twisted-26.4.0.ebuild | 172 +++++++++++++++++++++ dev-python/twisted/twisted-26.4.0_rc2.ebuild | 166 ++++++++++++++++++++ 10 files changed, 687 insertions(+) create mode 100644 dev-python/twisted/Manifest create mode 100644 dev-python/twisted/files/twistd.conf create mode 100644 dev-python/twisted/files/twistd.init create mode 100644 dev-python/twisted/files/twisted-25.5.0-py314.patch create mode 100644 dev-python/twisted/files/twisted-25.5.0-rebuild.patch create mode 100644 dev-python/twisted/files/twisted-26.4.0-py314.patch create mode 100644 dev-python/twisted/metadata.xml create mode 100644 dev-python/twisted/twisted-25.5.0-r1.ebuild create mode 100644 dev-python/twisted/twisted-26.4.0.ebuild create mode 100644 dev-python/twisted/twisted-26.4.0_rc2.ebuild (limited to 'dev-python/twisted') diff --git a/dev-python/twisted/Manifest b/dev-python/twisted/Manifest new file mode 100644 index 000000000000..4cc597ff9174 --- /dev/null +++ b/dev-python/twisted/Manifest @@ -0,0 +1,7 @@ +DIST twisted-25.5.0.tar.gz 3545725 BLAKE2B 01f24c3c90c3db349efe779a8262abab3004782aedd8534a8c53e5336d77862a3615c83093137074b19af415cdb5572e07c39a74846a128544e8405d9c69864b SHA512 3d023777854fdf54e06f4bbaf3159359767aac9ba33e90d2b2e8abe29815d088e00eebd06944c12610a28c517d9cb397a5104ff153160edabfb91dd16a15f597 +DIST twisted-25.5.0.tar.gz.provenance 9203 BLAKE2B 76180b9aa470977a28eb3a2104bf6cf6355cf0585df5cf8e07420e3878df32e92ae23eef7bb64bd3fb8d863c4b3727daf44074d2a1d5735236f1d24f89711797 SHA512 9f5d3d92194abbbd5ed0bd524a11858f8d75ae8e9cf89bb4689a82053bc107f4eea6adbe2862fc9bba74bd3623eac3183a3bd3163cce4a7eec20e4ee4988afa0 +DIST twisted-26.4.0.tar.gz 3575095 BLAKE2B 63e4e543cbff788e5a6346c00bfa8e85ffcf2ae2606e064b4f58fe97109b6e783681dfc9bbaefbf56f181eeebbb31b2942b6280993307f94d3885499008875e6 SHA512 03b9f8ead925c0cf42c2f74cfb1045fd119e4cb3e197606946b075ce8caf75eb2edad208b610f0ba8628da6b4dda5b29da7f2bd04f76a61a112d45f3e4b8ad22 +DIST twisted-26.4.0.tar.gz.provenance 9440 BLAKE2B b57532a8bf2df72638104c6c06d7fdcb8ee04304db83545056b934e8ec29c8d2b65b97e1faa1f3d19c73b1bae594b5e564f1caad4459c930ddba84800e950ef0 SHA512 3c33b4e511a0e786ae2d5a2e08f4b1af17a15082584b98cbfd109f29e5856a88f4798164b9b30a98ffbdb860c180450832134291d6784eabc756f215c0b717b5 +DIST twisted-26.4.0rc2.tar.gz 3575417 BLAKE2B 58f22a8fd475460b2d1db864b622bc2b0825bb24cbcface1a2cf299bb8e8206cd3c418ea8cb7baa0e19fdbeb4a8ef2ae41e66258329e9b232a4730069ff78d0e SHA512 f27629f801103eed16605809149588d2de9c3f8e837acc97f5481f68082024b971e13694c05bd35c90e875d9d0d362b5b824d0c967f4e333e7ae8268dfd77d7b +DIST twisted-26.4.0rc2.tar.gz.provenance 9402 BLAKE2B 28a09a6d6458f0448b00b674a8437b41fe0a27fc9380675986dcb56972c1f440f4a228b59eb87ddbfc8a6d0ac7e1e0e2e0dbcc973edb92f0ed87f5a629be79f6 SHA512 f5adfbb14641ae94ee78ce622c6ea86dc225640106297f70dbeb85ef703f9bfe38a8c6ac1da9ccdf6fdab84d1a43a943b772a04e8e5863a98ca8359f6a0fa6d1 +DIST twisted-regen-cache.gz 911 BLAKE2B ffd3fcda6c67ffe6fd3ef581c8d507548396b66ed0708e9a5c790095e579c0d5f0f71596acf05712989da2ddef2b8d437eca973bc4d80ef8a9fa852915f38305 SHA512 95a9b931c73017d16d1b5e6b41345dddffe62b6af1a8e93b5e40d06d3d15be17b0dd0181c767ffeeb791534d463764ef9e066fa6c2ee2ac4b53c86d1da8fce03 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?= +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 diff --git a/dev-python/twisted/metadata.xml b/dev-python/twisted/metadata.xml new file mode 100644 index 000000000000..d1ca5b984ae3 --- /dev/null +++ b/dev-python/twisted/metadata.xml @@ -0,0 +1,29 @@ + + + + + python@gentoo.org + Python + + + cpe:/a:twistedmatrix:twisted + + + include Twisted SSHv2 implementation + include serial port support + include websocket support + + Twisted is an event-based framework for internet + applications, supporting Python 2.7 and Python 3.3+. It includes + modules for many different purposes, including the following: + +twisted.web: HTTP clients and servers, HTML templating, and a WSGI server +twisted.conch: SSHv2 and Telnet clients and servers and terminal emulators +twisted.words: Clients and servers for IRC, XMPP, and other IM protocols +twisted.mail: IMAPv4, POP3, SMTP clients and servers +twisted.positioning: Tools for communicating with NMEA-compatible GPS receivers +twisted.names: DNS client and tools for making your own DNS servers +twisted.trial: A unit testing framework that integrates well with Twisted-based code. + + baldeagleos-repo + diff --git a/dev-python/twisted/twisted-25.5.0-r1.ebuild b/dev-python/twisted/twisted-25.5.0-r1.ebuild new file mode 100644 index 000000000000..c689ba3a7e05 --- /dev/null +++ b/dev-python/twisted/twisted-25.5.0-r1.ebuild @@ -0,0 +1,171 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=hatchling +PYPI_VERIFY_REPO=https://github.com/twisted/twisted +PYTHON_TESTED=( python3_{13..14} ) +PYTHON_COMPAT=( python3_{13..14} ) +PYTHON_REQ_USE="threads(+)" + +inherit distutils-r1 multiprocessing pypi virtualx + +DESCRIPTION="An asynchronous networking framework written in Python" +HOMEPAGE=" + https://twisted.org/ + https://github.com/twisted/twisted/ + https://pypi.org/project/Twisted/ +" +SRC_URI+=" + https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~arm64-macos ~x64-macos" +IUSE="conch http2 serial ssl test websockets" +RESTRICT="!test? ( test )" + +RDEPEND=" + >=dev-python/attrs-22.2.0[${PYTHON_USEDEP}] + >=dev-python/automat-24.8.0[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1[${PYTHON_USEDEP}] + >=dev-python/hyperlink-17.1.1[${PYTHON_USEDEP}] + >=dev-python/incremental-22.10.0[${PYTHON_USEDEP}] + >=dev-python/typing-extensions-4.2.0[${PYTHON_USEDEP}] + >=dev-python/zope-interface-5[${PYTHON_USEDEP}] + conch? ( + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] + >=dev-python/bcrypt-3.0.0[${PYTHON_USEDEP}] + >=dev-python/cryptography-3.3[${PYTHON_USEDEP}] + dev-python/pyasn1[${PYTHON_USEDEP}] + ) + http2? ( + >=dev-python/h2-3.2[${PYTHON_USEDEP}] + >=dev-python/priority-1.1.0[${PYTHON_USEDEP}] + ) + serial? ( + >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] + ) + ssl? ( + >=dev-python/pyopenssl-21.0.0[${PYTHON_USEDEP}] + >=dev-python/service-identity-18.1.0[${PYTHON_USEDEP}] + >=dev-python/idna-2.4[${PYTHON_USEDEP}] + ) + websockets? ( + dev-python/wsproto[${PYTHON_USEDEP}] + ) +" +IDEPEND=" + >=dev-python/attrs-19.2.0[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1[${PYTHON_USEDEP}] + >=dev-python/typing-extensions-4.2.0[${PYTHON_USEDEP}] + >=dev-python/zope-interface-5[${PYTHON_USEDEP}] +" +BDEPEND=" + >=dev-python/hatch-fancy-pypi-readme-22.5.0[${PYTHON_USEDEP}] + >=dev-python/incremental-22.10.0[${PYTHON_USEDEP}] + test? ( + ${RDEPEND} + $(python_gen_cond_dep ' + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] + >=dev-python/bcrypt-3.0.0[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] + >=dev-python/cython-test-exception-raiser-1.0.2[${PYTHON_USEDEP}] + >=dev-python/idna-2.4[${PYTHON_USEDEP}] + >=dev-python/httpx-0.27[${PYTHON_USEDEP}] + >=dev-python/hypothesis-6.56[${PYTHON_USEDEP}] + dev-python/pyasn1[${PYTHON_USEDEP}] + >=dev-python/pyhamcrest-2[${PYTHON_USEDEP}] + >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] + dev-python/wsproto[${PYTHON_USEDEP}] + virtual/openssh + ssl? ( + >=dev-python/pyopenssl-21.0.0[${PYTHON_USEDEP}] + >=dev-python/service-identity-18.1.0[${PYTHON_USEDEP}] + ) + ' "${PYTHON_TESTED[@]}") + ) +" + +python_prepare_all() { + local PATCHES=( + # https://github.com/twisted/twisted/pull/12460 + "${FILESDIR}/${P}-rebuild.patch" + # https://github.com/twisted/twisted/pull/12508 + "${FILESDIR}/${P}-py314.patch" + ) + + distutils-r1_python_prepare_all + + # upstream test for making releases; not very useful and requires + # sphinx (including on py2) + rm src/twisted/python/test/test_release.py || die + + # multicast tests fail within network-sandbox + sed -e 's:test_joinLeave:_&:' \ + -e 's:test_loopback:_&:' \ + -e 's:test_multiListen:_&:' \ + -e 's:test_multicast:_&:' \ + -i src/twisted/test/test_udp.py || die +} + +src_test() { + # the test suite handles missing file & failing ioctl()s gracefully + # but not permission errors from sandbox + addwrite /dev/net/tun + virtx distutils-r1_src_test +} + +python_test() { + if ! has "${EPYTHON}" "${PYTHON_TESTED[@]/_/.}"; then + einfo "Skipping tests on ${EPYTHON} (xfail)" + return + fi + + # breaks some tests by overriding empty environment + local -x SANDBOX_ON=0 + # for py3.13, see + # https://github.com/twisted/twisted/pull/12092#issuecomment-2194326096 + local -x LINES=25 COLUMNS=80 + "${EPYTHON}" -m twisted.trial -j "$(makeopts_jobs)" twisted || + die "Tests failed with ${EPYTHON}" +} + +python_install() { + distutils-r1_python_install + + # own the dropin.cache so we don't leave orphans + > "${D}$(python_get_sitedir)"/twisted/plugins/dropin.cache || die + + python_doscript "${WORKDIR}"/twisted-regen-cache +} + +python_install_all() { + distutils-r1_python_install_all + + newconfd "${FILESDIR}/twistd.conf" twistd + newinitd "${FILESDIR}/twistd.init" twistd +} + +python_postinst() { + twisted-regen-cache || die +} + +pkg_postinst() { + if [[ -z ${ROOT} ]]; then + python_foreach_impl python_postinst + fi +} + +python_postrm() { + rm -f "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" || die +} + +pkg_postrm() { + # if we're removing the last version, remove the cache file + if [[ ! ${REPLACING_VERSIONS} ]]; then + python_foreach_impl python_postrm + fi +} diff --git a/dev-python/twisted/twisted-26.4.0.ebuild b/dev-python/twisted/twisted-26.4.0.ebuild new file mode 100644 index 000000000000..fa55e2bbc140 --- /dev/null +++ b/dev-python/twisted/twisted-26.4.0.ebuild @@ -0,0 +1,172 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=hatchling +PYPI_VERIFY_REPO=https://github.com/twisted/twisted +PYTHON_TESTED=( python3_{13..14} ) +PYTHON_COMPAT=( python3_{13..14} ) +PYTHON_REQ_USE="threads(+)" + +inherit distutils-r1 multiprocessing pypi virtualx + +DESCRIPTION="An asynchronous networking framework written in Python" +HOMEPAGE=" + https://twisted.org/ + https://github.com/twisted/twisted/ + https://pypi.org/project/Twisted/ +" +SRC_URI+=" + https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz +" + +LICENSE="MIT" +SLOT="0" +if [[ ${PV} != *_rc* ]]; then + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos" +fi +IUSE="conch http2 serial ssl test websockets" +RESTRICT="!test? ( test )" + +RDEPEND=" + >=dev-python/attrs-22.2.0[${PYTHON_USEDEP}] + >=dev-python/automat-24.8.0[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1[${PYTHON_USEDEP}] + >=dev-python/hyperlink-17.1.1[${PYTHON_USEDEP}] + >=dev-python/incremental-22.10.0[${PYTHON_USEDEP}] + >=dev-python/typing-extensions-4.2.0[${PYTHON_USEDEP}] + >=dev-python/zope-interface-5[${PYTHON_USEDEP}] + conch? ( + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] + >=dev-python/bcrypt-3.2.1[${PYTHON_USEDEP}] + >=dev-python/cryptography-38[${PYTHON_USEDEP}] + dev-python/pyasn1[${PYTHON_USEDEP}] + ) + http2? ( + >=dev-python/h2-3.2[${PYTHON_USEDEP}] + >=dev-python/priority-1.1.0[${PYTHON_USEDEP}] + ) + serial? ( + >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] + ) + ssl? ( + >=dev-python/pyopenssl-25.2.0[${PYTHON_USEDEP}] + >=dev-python/service-identity-18.1.0[${PYTHON_USEDEP}] + >=dev-python/idna-2.4[${PYTHON_USEDEP}] + ) + websockets? ( + dev-python/wsproto[${PYTHON_USEDEP}] + ) +" +IDEPEND=" + >=dev-python/attrs-19.2.0[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1[${PYTHON_USEDEP}] + >=dev-python/typing-extensions-4.2.0[${PYTHON_USEDEP}] + >=dev-python/zope-interface-5[${PYTHON_USEDEP}] +" +BDEPEND=" + >=dev-python/hatch-fancy-pypi-readme-22.5.0[${PYTHON_USEDEP}] + >=dev-python/incremental-22.10.0[${PYTHON_USEDEP}] + test? ( + ${RDEPEND} + $(python_gen_cond_dep ' + !!dev-python/py + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] + >=dev-python/bcrypt-3.2.1[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] + >=dev-python/cython-test-exception-raiser-1.0.2[${PYTHON_USEDEP}] + >=dev-python/idna-2.4[${PYTHON_USEDEP}] + >=dev-python/httpx-0.27[${PYTHON_USEDEP}] + >=dev-python/hypothesis-6.56[${PYTHON_USEDEP}] + dev-python/pyasn1[${PYTHON_USEDEP}] + >=dev-python/pyhamcrest-2[${PYTHON_USEDEP}] + >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] + dev-python/wsproto[${PYTHON_USEDEP}] + virtual/openssh + ssl? ( + >=dev-python/pyopenssl-25.2.0[${PYTHON_USEDEP}] + >=dev-python/service-identity-18.1.0[${PYTHON_USEDEP}] + ) + ' "${PYTHON_TESTED[@]}") + ) +" + +python_prepare_all() { + local PATCHES=( + # https://github.com/twisted/twisted/pull/12637 + "${FILESDIR}/${P}-py314.patch" + ) + + distutils-r1_python_prepare_all + + # upstream test for making releases; not very useful and requires + # sphinx (including on py2) + rm src/twisted/python/test/test_release.py || die + + # multicast tests fail within network-sandbox + sed -e 's:test_joinLeave:_&:' \ + -e 's:test_loopback:_&:' \ + -e 's:test_multiListen:_&:' \ + -e 's:test_multicast:_&:' \ + -i src/twisted/test/test_udp.py || die +} + +src_test() { + # the test suite handles missing file & failing ioctl()s gracefully + # but not permission errors from sandbox + addwrite /dev/net/tun + virtx distutils-r1_src_test +} + +python_test() { + if ! has "${EPYTHON}" "${PYTHON_TESTED[@]/_/.}"; then + einfo "Skipping tests on ${EPYTHON} (xfail)" + return + fi + + # breaks some tests by overriding empty environment + local -x SANDBOX_ON=0 + # for py3.13, see + # https://github.com/twisted/twisted/pull/12092#issuecomment-2194326096 + local -x LINES=25 COLUMNS=80 + "${EPYTHON}" -m twisted.trial -j "$(makeopts_jobs)" twisted || + die "Tests failed with ${EPYTHON}" +} + +python_install() { + distutils-r1_python_install + + # own the dropin.cache so we don't leave orphans + > "${D}$(python_get_sitedir)"/twisted/plugins/dropin.cache || die + + python_doscript "${WORKDIR}"/twisted-regen-cache +} + +python_install_all() { + distutils-r1_python_install_all + + newconfd "${FILESDIR}/twistd.conf" twistd + newinitd "${FILESDIR}/twistd.init" twistd +} + +python_postinst() { + twisted-regen-cache || die +} + +pkg_postinst() { + if [[ -z ${ROOT} ]]; then + python_foreach_impl python_postinst + fi +} + +python_postrm() { + rm -f "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" || die +} + +pkg_postrm() { + # if we're removing the last version, remove the cache file + if [[ ! ${REPLACING_VERSIONS} ]]; then + python_foreach_impl python_postrm + fi +} diff --git a/dev-python/twisted/twisted-26.4.0_rc2.ebuild b/dev-python/twisted/twisted-26.4.0_rc2.ebuild new file mode 100644 index 000000000000..efaae3ebef02 --- /dev/null +++ b/dev-python/twisted/twisted-26.4.0_rc2.ebuild @@ -0,0 +1,166 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=hatchling +PYPI_VERIFY_REPO=https://github.com/twisted/twisted +PYTHON_TESTED=( python3_{13..14} ) +PYTHON_COMPAT=( python3_{13..14} ) +PYTHON_REQ_USE="threads(+)" + +inherit distutils-r1 multiprocessing pypi virtualx + +DESCRIPTION="An asynchronous networking framework written in Python" +HOMEPAGE=" + https://twisted.org/ + https://github.com/twisted/twisted/ + https://pypi.org/project/Twisted/ +" +SRC_URI+=" + https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz +" + +LICENSE="MIT" +SLOT="0" +if [[ ${PV} != *_rc* ]]; then + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos" +fi +IUSE="conch http2 serial ssl test websockets" +RESTRICT="!test? ( test )" + +RDEPEND=" + >=dev-python/attrs-22.2.0[${PYTHON_USEDEP}] + >=dev-python/automat-24.8.0[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1[${PYTHON_USEDEP}] + >=dev-python/hyperlink-17.1.1[${PYTHON_USEDEP}] + >=dev-python/incremental-22.10.0[${PYTHON_USEDEP}] + >=dev-python/typing-extensions-4.2.0[${PYTHON_USEDEP}] + >=dev-python/zope-interface-5[${PYTHON_USEDEP}] + conch? ( + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] + >=dev-python/bcrypt-3.2.1[${PYTHON_USEDEP}] + >=dev-python/cryptography-38[${PYTHON_USEDEP}] + dev-python/pyasn1[${PYTHON_USEDEP}] + ) + http2? ( + >=dev-python/h2-3.2[${PYTHON_USEDEP}] + >=dev-python/priority-1.1.0[${PYTHON_USEDEP}] + ) + serial? ( + >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] + ) + ssl? ( + >=dev-python/pyopenssl-25.2.0[${PYTHON_USEDEP}] + >=dev-python/service-identity-18.1.0[${PYTHON_USEDEP}] + >=dev-python/idna-2.4[${PYTHON_USEDEP}] + ) + websockets? ( + dev-python/wsproto[${PYTHON_USEDEP}] + ) +" +IDEPEND=" + >=dev-python/attrs-19.2.0[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1[${PYTHON_USEDEP}] + >=dev-python/typing-extensions-4.2.0[${PYTHON_USEDEP}] + >=dev-python/zope-interface-5[${PYTHON_USEDEP}] +" +BDEPEND=" + >=dev-python/hatch-fancy-pypi-readme-22.5.0[${PYTHON_USEDEP}] + >=dev-python/incremental-22.10.0[${PYTHON_USEDEP}] + test? ( + ${RDEPEND} + $(python_gen_cond_dep ' + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] + >=dev-python/bcrypt-3.2.1[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] + >=dev-python/cython-test-exception-raiser-1.0.2[${PYTHON_USEDEP}] + >=dev-python/idna-2.4[${PYTHON_USEDEP}] + >=dev-python/httpx-0.27[${PYTHON_USEDEP}] + >=dev-python/hypothesis-6.56[${PYTHON_USEDEP}] + dev-python/pyasn1[${PYTHON_USEDEP}] + >=dev-python/pyhamcrest-2[${PYTHON_USEDEP}] + >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] + dev-python/wsproto[${PYTHON_USEDEP}] + virtual/openssh + ssl? ( + >=dev-python/pyopenssl-25.2.0[${PYTHON_USEDEP}] + >=dev-python/service-identity-18.1.0[${PYTHON_USEDEP}] + ) + ' "${PYTHON_TESTED[@]}") + ) +" + +python_prepare_all() { + distutils-r1_python_prepare_all + + # upstream test for making releases; not very useful and requires + # sphinx (including on py2) + rm src/twisted/python/test/test_release.py || die + + # multicast tests fail within network-sandbox + sed -e 's:test_joinLeave:_&:' \ + -e 's:test_loopback:_&:' \ + -e 's:test_multiListen:_&:' \ + -e 's:test_multicast:_&:' \ + -i src/twisted/test/test_udp.py || die +} + +src_test() { + # the test suite handles missing file & failing ioctl()s gracefully + # but not permission errors from sandbox + addwrite /dev/net/tun + virtx distutils-r1_src_test +} + +python_test() { + if ! has "${EPYTHON}" "${PYTHON_TESTED[@]/_/.}"; then + einfo "Skipping tests on ${EPYTHON} (xfail)" + return + fi + + # breaks some tests by overriding empty environment + local -x SANDBOX_ON=0 + # for py3.13, see + # https://github.com/twisted/twisted/pull/12092#issuecomment-2194326096 + local -x LINES=25 COLUMNS=80 + "${EPYTHON}" -m twisted.trial -j "$(makeopts_jobs)" twisted || + die "Tests failed with ${EPYTHON}" +} + +python_install() { + distutils-r1_python_install + + # own the dropin.cache so we don't leave orphans + > "${D}$(python_get_sitedir)"/twisted/plugins/dropin.cache || die + + python_doscript "${WORKDIR}"/twisted-regen-cache +} + +python_install_all() { + distutils-r1_python_install_all + + newconfd "${FILESDIR}/twistd.conf" twistd + newinitd "${FILESDIR}/twistd.init" twistd +} + +python_postinst() { + twisted-regen-cache || die +} + +pkg_postinst() { + if [[ -z ${ROOT} ]]; then + python_foreach_impl python_postinst + fi +} + +python_postrm() { + rm -f "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" || die +} + +pkg_postrm() { + # if we're removing the last version, remove the cache file + if [[ ! ${REPLACING_VERSIONS} ]]; then + python_foreach_impl python_postrm + fi +} -- cgit v1.3