dev-python/twisted: Bump to 26.4.0

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2026-05-11 19:54:43 +02:00
parent 7ac70c406d
commit e092fd7feb
3 changed files with 217 additions and 0 deletions

View File

@@ -1,5 +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

View File

@@ -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

View File

@@ -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_{11..14} pypy3_11 )
PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" )
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
}