commit:     bd1823b11ee33e884083f92047071e3cb82cb0d9
Author:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 31 10:30:25 2024 +0000
Commit:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
CommitDate: Wed Jul 31 15:08:58 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd1823b1

dev-python/twisted: add 24.7.0_rc1

Few tests are skipped by a patch based on changes made in upstream PR
https://github.com/twisted/twisted/pull/12092.

Some tests fail with openssh-9.8, therefore, this test dependency is
restricted to <net-misc/openssh-9.8. See
https://github.com/twisted/twisted/issues/12273

Signed-off-by: Petr Vaněk <arkamar <AT> gentoo.org>

 dev-python/twisted/Manifest                        |   1 +
 .../twisted-24.7.0_rc1-skip-py313-tests.patch      |  54 +++++++
 dev-python/twisted/twisted-24.7.0_rc1.ebuild       | 161 +++++++++++++++++++++
 3 files changed, 216 insertions(+)

diff --git a/dev-python/twisted/Manifest b/dev-python/twisted/Manifest
index c721f0b6b783..4bebe2fb86ae 100644
--- a/dev-python/twisted/Manifest
+++ b/dev-python/twisted/Manifest
@@ -1,3 +1,4 @@
 DIST twisted-24.3.0.tar.gz 3500456 BLAKE2B 
b2cebb2f3482dbeba250786b1977ddbb09e1a9a81f71ce5906efe8289b0e134a8b26c191c2262e8ee8ba3fccccea508c34145016b29ecf301541134dcea19e08
 SHA512 
c3dd227f5936ffa586a0b7447f5df4c2257dce0c0ba740373d82197a72029e7eeb0aef9789247dde73e2f24dd043f3b0b7d795f16e6e908583b054aad9b9eb6a
 DIST twisted-24.3.0_p20240628.gh.tar.gz 3598828 BLAKE2B 
6f37190caa0fe6e0ff566cb4f86b625425bfe60d8743b4c22463da63df3184646eda2b7d1a73e30452390bab54f8001f9eb33e1e7adc645071fe0eba4fb2d30c
 SHA512 
f182d6c5006f1043f3586468d628b6b87a4d74d4aa1ce3c882938f0a831a191b38b311a4cf68488b24cd3d87547aeb0b9725e93ce4be86638aa11552d294cd95
+DIST twisted-24.7.0rc1.tar.gz 3517026 BLAKE2B 
ce7c2aec350c08ccaee03010dcff7f82fb37760d905206862e77c77c71d5eb8a0c9e04433bfe3ef19f39761ddbacdacb1eeb64b4de6663569f06ed06302276f9
 SHA512 
7bc5a65d1813573e980c1171a579d3b76a0275706175c2d83d5cfe389bc8ef1e965ec50b4680579af1eb796ed7131eb0bbad173ef2a73c9ed0a367f6a121666a
 DIST twisted-regen-cache.gz 911 BLAKE2B 
ffd3fcda6c67ffe6fd3ef581c8d507548396b66ed0708e9a5c790095e579c0d5f0f71596acf05712989da2ddef2b8d437eca973bc4d80ef8a9fa852915f38305
 SHA512 
95a9b931c73017d16d1b5e6b41345dddffe62b6af1a8e93b5e40d06d3d15be17b0dd0181c767ffeeb791534d463764ef9e066fa6c2ee2ac4b53c86d1da8fce03

diff --git a/dev-python/twisted/files/twisted-24.7.0_rc1-skip-py313-tests.patch 
b/dev-python/twisted/files/twisted-24.7.0_rc1-skip-py313-tests.patch
new file mode 100644
index 000000000000..9be4283567ec
--- /dev/null
+++ b/dev-python/twisted/files/twisted-24.7.0_rc1-skip-py313-tests.patch
@@ -0,0 +1,54 @@
+From 314fb5e18cbcaa11040a129d6ffaee3c376f55e7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <[email protected]>
+Date: Wed, 31 Jul 2024 15:08:20 +0200
+Subject: [PATCH] skip py3.13 incompatible tests
+
+Based on upstream changes in PR https://github.com/twisted/twisted/pull/12092
+
+diff --git a/src/twisted/internet/test/test_inlinecb.py 
b/src/twisted/internet/test/test_inlinecb.py
+index 355572b566..11c09c6996 100644
+--- a/src/twisted/internet/test/test_inlinecb.py
++++ b/src/twisted/internet/test/test_inlinecb.py
+@@ -6,11 +6,13 @@
+ Tests for L{twisted.internet.inlineCallbacks}.
+ """
+ 
++import sys
+ import traceback
+ import unittest as pyunit
+ import weakref
+ from enum import Enum
+ from typing import Any, Generator, List, Set, Union
++from unittest import skipIf
+ 
+ from twisted.internet import reactor, task
+ from twisted.internet.defer import (
+@@ -1122,6 +1124,9 @@ class NonLocalExitTests(TestCase):
+ 
+ 
+ class ForwardTraceBackTests(SynchronousTestCase):
++    HAVE_PY3_12_OR_OLDER = sys.version_info < (3, 13)
++
++    @skipIf(not HAVE_PY3_12_OR_OLDER, "Needs Python 3.12 or older")
+     def test_forwardTracebacks(self):
+         """
+         Chained inlineCallbacks are forwarding the traceback information
+@@ -1171,6 +1176,7 @@ class ForwardTraceBackTests(SynchronousTestCase):
+ 
+         return d
+ 
++    @skipIf(not HAVE_PY3_12_OR_OLDER, "Needs Python 3.12 or older")
+     def test_forwardLotsOfTracebacks(self):
+         """
+         Several Chained inlineCallbacks gives information about all 
generators.
+@@ -1218,6 +1224,7 @@ class ForwardTraceBackTests(SynchronousTestCase):
+         self.assertIn("Error Marker", tb)
+         self.assertIn("in erroring", f.getTraceback())
+ 
++    @skipIf(not HAVE_PY3_12_OR_OLDER, "Needs Python 3.12 or older")
+     def test_forwardLotsOfTracebacksCoro(self):
+         """
+         Several chained inlineCallbacks mixed with coroutines gives 
information
+-- 
+2.44.2
+

diff --git a/dev-python/twisted/twisted-24.7.0_rc1.ebuild 
b/dev-python/twisted/twisted-24.7.0_rc1.ebuild
new file mode 100644
index 000000000000..dc3b1cf4ce80
--- /dev/null
+++ b/dev-python/twisted/twisted-24.7.0_rc1.ebuild
@@ -0,0 +1,161 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=hatchling
+PYTHON_TESTED=( python3_{10..13} pypy3 )
+PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1 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 ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos"
+IUSE="conch http2 serial ssl test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       >=dev-python/attrs-19.2.0[${PYTHON_USEDEP}]
+       >=dev-python/automat-0.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-5.0[${PYTHON_USEDEP}]
+               >=dev-python/h2-3.0.0[${PYTHON_USEDEP}]
+               <dev-python/priority-2.0[${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}]
+       )
+"
+# tests fail with openssh-9.8, see 
https://github.com/twisted/twisted/issues/12273
+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-2[${PYTHON_USEDEP}]
+                       
>=dev-python/cython-test-exception-raiser-1.0.2[${PYTHON_USEDEP}]
+                       >=dev-python/idna-2.4[${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}]
+                       virtual/openssh
+                       <net-misc/openssh-9.8
+                       ssl? (
+                               >=dev-python/pyopenssl-21.0.0[${PYTHON_USEDEP}]
+                               
>=dev-python/service-identity-18.1.0[${PYTHON_USEDEP}]
+                       )
+               ' "${PYTHON_TESTED[@]}")
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-24.3.0_p20240628-skip-py313-test.patch"
+       "${FILESDIR}/${PN}-24.7.0_rc1-skip-py313-tests.patch"
+)
+
+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
+
+       distutils-r1_python_prepare_all
+}
+
+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
+       local -x LINES=25
+       local -x COLUMNS=80
+       "${EPYTHON}" -m twisted.trial 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
+}

Reply via email to