From 3ec996ddb1514553ebcb96d872b464fd9115437e Mon Sep 17 00:00:00 2001 From: tigro Date: Sun, 5 Jan 2025 23:22:38 +0300 Subject: [PATCH] import python-twisted-23.10.0-7.el10 --- .gitignore | 1 + .python-twisted.metadata | 1 + ...ation-of-3-arg-signature-of-generato.patch | 31 + ...02-23.10.0-fix-and-skip-tests-fedora.patch | 181 ++++++ SOURCES/0003-python3.12.1.patch | 179 ++++++ ...ove-the-usage-of-cgi.parse_multipart.patch | 137 +++++ ...e-dis.findlinestarts-for-Python-3.13.patch | 42 ++ SOURCES/0006-fix-inlinecb-tests.patch | 286 +++++++++ ...he-new-traceback-pointing-characters.patch | 24 + SOURCES/0010-Skip-failing-tests.patch | 91 +++ SOURCES/12064.patch | 97 +++ SOURCES/12066.patch | 34 ++ SPECS/python-twisted.spec | 560 ++++++++++++++++++ 13 files changed, 1664 insertions(+) create mode 100644 .gitignore create mode 100644 .python-twisted.metadata create mode 100644 SOURCES/0001-Adjust-to-deprecation-of-3-arg-signature-of-generato.patch create mode 100644 SOURCES/0002-23.10.0-fix-and-skip-tests-fedora.patch create mode 100644 SOURCES/0003-python3.12.1.patch create mode 100644 SOURCES/0004-Remove-the-usage-of-cgi.parse_multipart.patch create mode 100644 SOURCES/0005-Update-dis.findlinestarts-for-Python-3.13.patch create mode 100644 SOURCES/0006-fix-inlinecb-tests.patch create mode 100644 SOURCES/0009-Account-with-the-new-traceback-pointing-characters.patch create mode 100644 SOURCES/0010-Skip-failing-tests.patch create mode 100644 SOURCES/12064.patch create mode 100644 SOURCES/12066.patch create mode 100644 SPECS/python-twisted.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f0e3b76 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/twisted-23.10.0.tar.gz diff --git a/.python-twisted.metadata b/.python-twisted.metadata new file mode 100644 index 0000000..2b6d4eb --- /dev/null +++ b/.python-twisted.metadata @@ -0,0 +1 @@ +26b660dad1c80ad1ee821b651ca5e37c6d9f955a SOURCES/twisted-23.10.0.tar.gz diff --git a/SOURCES/0001-Adjust-to-deprecation-of-3-arg-signature-of-generato.patch b/SOURCES/0001-Adjust-to-deprecation-of-3-arg-signature-of-generato.patch new file mode 100644 index 0000000..2e54823 --- /dev/null +++ b/SOURCES/0001-Adjust-to-deprecation-of-3-arg-signature-of-generato.patch @@ -0,0 +1,31 @@ +From 0bd00bf2fdb3d0039913a3ce747f20197f55c1aa Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Fri, 27 Oct 2023 16:56:24 -0700 +Subject: [PATCH] Adjust to deprecation of 3-arg signature of generator.throw() + +In Python 3.12, the 3-arg signature of generator.throw() is +deprecated, you're only supposed to use the 1-arg signature +where you pass only an exception instance. I *think* this is the +right thing to pass in this case. + +Signed-off-by: Adam Williamson +--- + src/twisted/python/failure.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/twisted/python/failure.py b/src/twisted/python/failure.py +index ca893ca4c9..c006d555e5 100644 +--- a/src/twisted/python/failure.py ++++ b/src/twisted/python/failure.py +@@ -516,7 +516,7 @@ class Failure(BaseException): + """ + # Note that the actual magic to find the traceback information + # is done in _findFailure. +- return g.throw(self.type, self.value, self.tb) ++ return g.throw(self.value.with_traceback(self.tb)) + + @classmethod + def _findFailure(cls): +-- +2.41.0 + diff --git a/SOURCES/0002-23.10.0-fix-and-skip-tests-fedora.patch b/SOURCES/0002-23.10.0-fix-and-skip-tests-fedora.patch new file mode 100644 index 0000000..c78b37b --- /dev/null +++ b/SOURCES/0002-23.10.0-fix-and-skip-tests-fedora.patch @@ -0,0 +1,181 @@ +diff -up twisted-twisted-23.10.0/src/twisted/conch/test/test_cftp.py.orig twisted-twisted-23.10.0/src/twisted/conch/test/test_cftp.py +--- twisted-twisted-23.10.0/src/twisted/conch/test/test_cftp.py.orig 2023-10-31 01:14:47.000000000 -0600 ++++ twisted-twisted-23.10.0/src/twisted/conch/test/test_cftp.py 2023-10-31 19:40:05.091714294 -0600 +@@ -1436,6 +1436,7 @@ exit + @skipIf(skipTests, "don't run w/o spawnProcess or cryptography") + @skipIf(not which("ssh"), "no ssh command-line client available") + @skipIf(not which("sftp"), "no sftp command-line client available") ++@skipIf(True, "no networking in Fedora buildsystem") + class OurServerSftpClientTests(CFTPClientTestBase): + """ + Test the sftp server against sftp command line client. +@@ -1479,11 +1480,11 @@ class OurServerSftpClientTests(CFTPClien + # first need to check if we can set it. If we can, -V will just print + # the version without doing anything else; if we can't, we will get a + # configuration error. +- d = getProcessValue("ssh", ("-o", "PubkeyAcceptedKeyTypes=ssh-dss", "-V"), env) ++ d = getProcessValue("ssh", ("-o", "PubkeyAcceptedKeyTypes=ssh-rsa", "-V"), env) + + def hasPAKT(status): + if status == 0: +- args = ("-o", "PubkeyAcceptedKeyTypes=ssh-dss") ++ args = ("-o", "PubkeyAcceptedKeyTypes=+ssh-rsa") + else: + args = () + # Pass -F /dev/null to avoid the user's configuration file from +@@ -1497,7 +1498,9 @@ class OurServerSftpClientTests(CFTPClien + "-o", + "UserKnownHostsFile=kh_test", + "-o", +- "HostKeyAlgorithms=ssh-rsa", ++ "HostKeyAlgorithms=+ssh-rsa", ++ "-o", ++ "PubkeyAcceptedKeyTypes=+ssh-rsa", + "-o", + "Port=%i" % (port,), + "-b", +diff -up twisted-twisted-23.10.0/src/twisted/conch/test/test_checkers.py.orig twisted-twisted-23.10.0/src/twisted/conch/test/test_checkers.py +--- twisted-twisted-23.10.0/src/twisted/conch/test/test_checkers.py.orig 2023-10-31 01:14:47.000000000 -0600 ++++ twisted-twisted-23.10.0/src/twisted/conch/test/test_checkers.py 2023-10-31 19:40:05.092714302 -0600 +@@ -12,6 +12,8 @@ from collections import namedtuple + from io import BytesIO + from typing import Optional + ++from unittest import skipIf ++ + cryptSkip: Optional[str] + try: + import crypt +@@ -53,6 +55,7 @@ else: + euidSkip = "Cannot run without effective UIDs (questionable)" + + ++@skipIf(True, "disable in Fedora buildsys") + class HelperTests(TestCase): + """ + Tests for helper functions L{verifyCryptedPassword}, L{_pwdGetByName} and +diff -up twisted-twisted-23.10.0/src/twisted/conch/test/test_conch.py.orig twisted-twisted-23.10.0/src/twisted/conch/test/test_conch.py +--- twisted-twisted-23.10.0/src/twisted/conch/test/test_conch.py.orig 2023-10-31 01:14:47.000000000 -0600 ++++ twisted-twisted-23.10.0/src/twisted/conch/test/test_conch.py 2023-10-31 19:40:05.092714302 -0600 +@@ -421,7 +421,7 @@ class ForwardingMixin(ConchServerSetupMi + localPort = self._getFreePort() + process = ConchTestForwardingProcess(localPort, b"test\n") + d = self.execute( +- "", process, sshArgs="-N -L%i:127.0.0.1:%i" % (localPort, self.echoPort) ++ "", process, sshArgs="-oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedKeyTypes=+ssh-rsa -N -L%i:127.0.0.1:%i" % (localPort, self.echoPort) + ) + d.addCallback(self.assertEqual, b"test\n") + return d +@@ -434,7 +434,7 @@ class ForwardingMixin(ConchServerSetupMi + localPort = self._getFreePort() + process = ConchTestForwardingProcess(localPort, b"test\n") + d = self.execute( +- "", process, sshArgs="-N -R %i:127.0.0.1:%i" % (localPort, self.echoPort) ++ "", process, sshArgs="-oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedKeyTypes=+ssh-rsa -N -R %i:127.0.0.1:%i" % (localPort, self.echoPort) + ) + d.addCallback(self.assertEqual, b"test\n") + return d +@@ -572,12 +572,12 @@ class OpenSSHClientMixin: + # the version without doing anything else; if we can't, we will get a + # configuration error. + d = getProcessValue( +- which("ssh")[0], ("-o", "PubkeyAcceptedKeyTypes=ssh-dss", "-V") ++ which("ssh")[0], ("-o", "PubkeyAcceptedKeyTypes=ssh-rsa", "-V") + ) + + def hasPAKT(status): + if status == 0: +- opts = "-oPubkeyAcceptedKeyTypes=ssh-dss " ++ opts = "-oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedKeyTypes=+ssh-rsa " + else: + opts = "" + +@@ -592,7 +592,8 @@ class OpenSSHClientMixin: + "-oUserKnownHostsFile=kh_test " + "-oPasswordAuthentication=no " + # Always use the RSA key, since that's the one in kh_test. +- "-oHostKeyAlgorithms=ssh-rsa " ++ "-oHostKeyAlgorithms=+ssh-rsa " ++ "-oPubkeyAcceptedKeyTypes=+ssh-rsa " + "-a " + "-i dsa_test " + ) +@@ -614,6 +615,7 @@ class OpenSSHClientMixin: + return d.addCallback(hasPAKT) + + ++@skipIf(True, "broken on Fedora, possibly crypto policies") + class OpenSSHKeyExchangeTests(ConchServerSetupMixin, OpenSSHClientMixin, TestCase): + """ + Tests L{SSHTransportBase}'s key exchange algorithm compatibility with +@@ -706,6 +708,7 @@ class OpenSSHKeyExchangeTests(ConchServe + ) + + ++@skipIf(True, "no networking in Fedora buildsystem") + class OpenSSHClientForwardingTests(ForwardingMixin, OpenSSHClientMixin, TestCase): + """ + Connection forwarding tests run against the OpenSSL command line client. +@@ -719,12 +722,13 @@ class OpenSSHClientForwardingTests(Forwa + localPort = self._getFreePort() + process = ConchTestForwardingProcess(localPort, b"test\n") + d = self.execute( +- "", process, sshArgs="-N -L%i:[::1]:%i" % (localPort, self.echoPortV6) ++ "", process, sshArgs="-oHostKeyAlgorithms=+ssh-rsa -oPubkeyAcceptedKeyTypes=+ssh-rsa -N -L%i:[::1]:%i" % (localPort, self.echoPortV6) + ) + d.addCallback(self.assertEqual, b"test\n") + return d + + ++@skipIf(True, "broken on Fedora, possibly crypto policies") + class OpenSSHClientRekeyTests(RekeyTestsMixin, OpenSSHClientMixin, TestCase): + """ + Rekeying tests run against the OpenSSL command line client. +@@ -755,6 +759,8 @@ class CmdLineClientTests(ForwardingMixin + "--user-authentications publickey " + "-a " + "-i dsa_test " ++ "-oHostKeyAlgorithms=+ssh-rsa " ++ "-oPubkeyAcceptedKeyTypes=+ssh-rsa " + "-v ".format(port) + sshArgs + " 127.0.0.1 " + remoteCommand + ) + cmds = _makeArgs(conchArgs + cmd.split()) +diff -up twisted-twisted-23.10.0/src/twisted/test/test_failure.py.orig twisted-twisted-23.10.0/src/twisted/test/test_failure.py +--- twisted-twisted-23.10.0/src/twisted/test/test_failure.py.orig 2023-10-31 01:14:47.000000000 -0600 ++++ twisted-twisted-23.10.0/src/twisted/test/test_failure.py 2023-10-31 19:40:05.093714309 -0600 +@@ -18,7 +18,10 @@ from types import TracebackType + from typing import Any, Generator + from unittest import skipIf + +-from cython_test_exception_raiser import raiser # type: ignore[import] ++try: ++ from cython_test_exception_raiser import raiser # type: ignore[import] ++except ImportError: ++ raiser = None + + from twisted.python import failure, reflect + from twisted.trial.unittest import SynchronousTestCase +diff -up twisted-twisted-23.10.0/src/twisted/test/test_main.py.orig twisted-twisted-23.10.0/src/twisted/test/test_main.py +--- twisted-twisted-23.10.0/src/twisted/test/test_main.py.orig 2023-10-31 01:14:47.000000000 -0600 ++++ twisted-twisted-23.10.0/src/twisted/test/test_main.py 2023-10-31 19:40:05.093714309 -0600 +@@ -13,7 +13,9 @@ from twisted.internet import defer, reac + from twisted.test.test_process import Accumulator + from twisted.trial.unittest import TestCase + ++from unittest import skipIf + ++@skipIf(True, "PYTHONPATH lost on sub process, just skip these vs passing this in") + class MainTests(TestCase): + """Test that twisted scripts can be invoked as modules.""" + +diff -up twisted-twisted-23.10.0/src/twisted/test/test_udp.py.orig twisted-twisted-23.10.0/src/twisted/test/test_udp.py +--- twisted-twisted-23.10.0/src/twisted/test/test_udp.py.orig 2023-10-31 01:14:47.000000000 -0600 ++++ twisted-twisted-23.10.0/src/twisted/test/test_udp.py 2023-10-31 19:40:05.093714309 -0600 +@@ -599,6 +599,7 @@ class MulticastTests(TestCase): + o.transport.setTTL(2) + self.assertEqual(o.transport.getTTL(), 2) + ++ @skipIf(True, "no networking in Fedora buildsystem") + def test_loopback(self): + """ + Test that after loopback mode has been set, multicast packets are diff --git a/SOURCES/0003-python3.12.1.patch b/SOURCES/0003-python3.12.1.patch new file mode 100644 index 0000000..eb0a838 --- /dev/null +++ b/SOURCES/0003-python3.12.1.patch @@ -0,0 +1,179 @@ +From 3038382d8b01912358419cee96a56730499881e1 Mon Sep 17 00:00:00 2001 +From: Adi Roiban +Date: Mon, 18 Dec 2023 13:42:28 +0000 +Subject: [PATCH 1/4] Run with latest Python. + +--- + .github/workflows/test.yaml | 6 +++--- + src/twisted/newsfragments/12052.1.misc | 0 + 2 files changed, 3 insertions(+), 3 deletions(-) + create mode 100644 src/twisted/newsfragments/12052.1.misc + +diff --git a/src/twisted/newsfragments/12052.1.misc b/src/twisted/newsfragments/12052.1.misc +new file mode 100644 +index 00000000000..e69de29bb2d + +From e208717cb5f9831a81d4e867c42cf66016bd70f6 Mon Sep 17 00:00:00 2001 +From: Adi Roiban +Date: Mon, 18 Dec 2023 13:43:02 +0000 +Subject: [PATCH 2/4] Add support for latest python 3.12.1 unittest skip + method. + +--- + src/twisted/trial/reporter.py | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/src/twisted/trial/reporter.py b/src/twisted/trial/reporter.py +index 2664b2fe0d5..2f6b8909a0e 100644 +--- a/src/twisted/trial/reporter.py ++++ b/src/twisted/trial/reporter.py +@@ -96,6 +96,11 @@ class TestResult(pyunit.TestResult): + expectedFailures: List[Tuple[itrial.ITestCase, str, "Todo"]] # type: ignore[assignment] + unexpectedSuccesses: List[Tuple[itrial.ITestCase, str]] # type: ignore[assignment] + successes: int ++ # The time when the test was started. ++ # It might be 0 if the tests was skipped, so never started. ++ _testStarted: int ++ # The duration of the test. It can be zero if tests was skipped. ++ _lastTime: int + + def __init__(self): + super().__init__() +@@ -104,6 +109,8 @@ def __init__(self): + self.unexpectedSuccesses = [] + self.successes = 0 + self._timings = [] ++ self._testStarted = 0 ++ self._lastTime = 0 + + def __repr__(self) -> str: + return "<%s run=%d errors=%d failures=%d todos=%d dones=%d skips=%d>" % ( +@@ -146,7 +153,8 @@ def stopTest(self, test): + @type test: L{pyunit.TestCase} + """ + super().stopTest(test) +- self._lastTime = self._getTime() - self._testStarted ++ if self._testStarted: ++ self._lastTime = self._getTime() - self._testStarted + + def addFailure(self, test, fail): + """ + +From c14f5f8717a314b1cf70277f1ff766b1962865ec Mon Sep 17 00:00:00 2001 +From: Adi Roiban +Date: Tue, 19 Dec 2023 08:54:50 +0000 +Subject: [PATCH 3/4] Update after review. + +--- + src/twisted/newsfragments/12052.1.misc | 0 + src/twisted/newsfragments/12052.removal | 4 ++++ + src/twisted/trial/reporter.py | 21 ++++++++++++--------- + 3 files changed, 16 insertions(+), 9 deletions(-) + delete mode 100644 src/twisted/newsfragments/12052.1.misc + create mode 100644 src/twisted/newsfragments/12052.removal + +diff --git a/src/twisted/newsfragments/12052.1.misc b/src/twisted/newsfragments/12052.1.misc +deleted file mode 100644 +index e69de29bb2d..00000000000 +diff --git a/src/twisted/newsfragments/12052.removal b/src/twisted/newsfragments/12052.removal +new file mode 100644 +index 00000000000..e236451bf57 +--- /dev/null ++++ b/src/twisted/newsfragments/12052.removal +@@ -0,0 +1,4 @@ ++twisted.trial.reporter.TestRun.startTest() is no longer called for tests ++with skip annotation or skip attribute for Python 3.12.1 or newer. ++This is the result of upstream Python gh-106584 change. ++The behavior is not change in 3.12.0 or older. +diff --git a/src/twisted/trial/reporter.py b/src/twisted/trial/reporter.py +index 2f6b8909a0e..a0e0b8dc506 100644 +--- a/src/twisted/trial/reporter.py ++++ b/src/twisted/trial/reporter.py +@@ -7,7 +7,7 @@ + """ + Defines classes that handle the results of tests. + """ +- ++from __future__ import annotations + + import os + import sys +@@ -16,7 +16,7 @@ + import warnings + from collections import OrderedDict + from types import TracebackType +-from typing import TYPE_CHECKING, List, Tuple, Type, Union ++from typing import TYPE_CHECKING, List, Optional, Tuple, Type, Union + + from zope.interface import implementer + +@@ -87,6 +87,11 @@ class TestResult(pyunit.TestResult): + + @ivar successes: count the number of successes achieved by the test run. + @type successes: C{int} ++ ++ @ivar _startTime: The time when the current test was started. It defaults to ++ L{None}, which means that the test was skipped. ++ @ivar _lastTime: The duration of the current test run. It defaults to ++ L{None}, which means that the test was skipped. + """ + + # Used when no todo provided to addExpectedFailure or addUnexpectedSuccess. +@@ -96,11 +101,9 @@ class TestResult(pyunit.TestResult): + expectedFailures: List[Tuple[itrial.ITestCase, str, "Todo"]] # type: ignore[assignment] + unexpectedSuccesses: List[Tuple[itrial.ITestCase, str]] # type: ignore[assignment] + successes: int +- # The time when the test was started. +- # It might be 0 if the tests was skipped, so never started. +- _testStarted: int ++ _testStarted: Optional[int] + # The duration of the test. It can be zero if tests was skipped. +- _lastTime: int ++ _lastTime: Optional[int] + + def __init__(self): + super().__init__() +@@ -109,8 +112,8 @@ def __init__(self): + self.unexpectedSuccesses = [] + self.successes = 0 + self._timings = [] +- self._testStarted = 0 +- self._lastTime = 0 ++ self._testStarted = None ++ self._lastTime = None + + def __repr__(self) -> str: + return "<%s run=%d errors=%d failures=%d todos=%d dones=%d skips=%d>" % ( +@@ -153,7 +156,7 @@ def stopTest(self, test): + @type test: L{pyunit.TestCase} + """ + super().stopTest(test) +- if self._testStarted: ++ if self._testStarted is not None: + self._lastTime = self._getTime() - self._testStarted + + def addFailure(self, test, fail): + +From 10e759a3c365cb4d07f5c8aacf608f63ffc92447 Mon Sep 17 00:00:00 2001 +From: Glyph +Date: Tue, 19 Dec 2023 13:13:22 -0500 +Subject: [PATCH 4/4] Update src/twisted/trial/reporter.py + +Co-authored-by: Jean-Paul Calderone +--- + src/twisted/trial/reporter.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/twisted/trial/reporter.py b/src/twisted/trial/reporter.py +index a0e0b8dc506..a803c5103e0 100644 +--- a/src/twisted/trial/reporter.py ++++ b/src/twisted/trial/reporter.py +@@ -102,7 +102,7 @@ class TestResult(pyunit.TestResult): + unexpectedSuccesses: List[Tuple[itrial.ITestCase, str]] # type: ignore[assignment] + successes: int + _testStarted: Optional[int] +- # The duration of the test. It can be zero if tests was skipped. ++ # The duration of the test. It is None until the test completes. + _lastTime: Optional[int] + + def __init__(self): diff --git a/SOURCES/0004-Remove-the-usage-of-cgi.parse_multipart.patch b/SOURCES/0004-Remove-the-usage-of-cgi.parse_multipart.patch new file mode 100644 index 0000000..ce90350 --- /dev/null +++ b/SOURCES/0004-Remove-the-usage-of-cgi.parse_multipart.patch @@ -0,0 +1,137 @@ +From 29353a92f01280ee2af3cc25ec80032db28a4e98 Mon Sep 17 00:00:00 2001 +From: Adi Roiban +Date: Tue, 16 Jan 2024 10:52:21 +0100 +Subject: [PATCH] Remove the usage of cgi.parse_multipart and replace with + email module + +--- + src/twisted/web/http.py | 87 ++++++++++++++++++++--------------------- + 1 file changed, 42 insertions(+), 45 deletions(-) + +diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py +index 2bad147..d4b12d8 100644 +--- a/src/twisted/web/http.py ++++ b/src/twisted/web/http.py +@@ -100,13 +100,14 @@ __all__ = [ + import base64 + import binascii + import calendar +-import cgi + import math + import os + import re + import tempfile + import time + import warnings ++from email import message_from_bytes ++from email.message import EmailMessage + from io import BytesIO + from typing import AnyStr, Callable, List, Optional, Tuple + from urllib.parse import ( +@@ -224,15 +225,40 @@ weekdayname_lower = [name.lower() for name in weekdayname] + monthname_lower = [name and name.lower() for name in monthname] + + +-def _parseHeader(line): +- # cgi.parse_header requires a str +- key, pdict = cgi.parse_header(line.decode("charmap")) ++def _parseContentType(line: bytes) -> bytes: ++ """ ++ Parse the Content-Type header. ++ """ ++ msg = EmailMessage() ++ msg["content-type"] = line.decode("charmap") ++ key = msg.get_content_type() ++ encodedKey = key.encode("charmap") ++ return encodedKey ++ ++ ++class _MultiPartParseException(Exception): ++ """ ++ Failed to parse the multipart/form-data payload. ++ """ ++ + +- # We want the key as bytes, and cgi.parse_multipart (which consumes +- # pdict) expects a dict of str keys but bytes values +- key = key.encode("charmap") +- pdict = {x: y.encode("charmap") for x, y in pdict.items()} +- return (key, pdict) ++def _getMultiPartArgs(content, ctype): ++ """ ++ Parse the content of a multipart/form-data request. ++ """ ++ result = {} ++ multiPartHeaders = b"MIME-Version: 1.0\r\n" + b"Content-Type: " + ctype + b"\r\n" ++ msg = message_from_bytes(multiPartHeaders + content) ++ if not msg.is_multipart(): ++ raise _MultiPartParseException("Not a multipart.") ++ ++ for part in msg.get_payload(): ++ name = part.get_param("name", header="content-disposition") ++ if not name: ++ continue ++ payload = part.get_payload(decode=True) ++ result[name.encode("utf8")] = [payload] ++ return result + + + def urlparse(url): +@@ -973,47 +999,18 @@ class Request: + + if self.method == b"POST" and ctype and clength: + mfd = b"multipart/form-data" +- key, pdict = _parseHeader(ctype) +- # This weird CONTENT-LENGTH param is required by +- # cgi.parse_multipart() in some versions of Python 3.7+, see +- # bpo-29979. It looks like this will be relaxed and backported, see +- # https://github.com/python/cpython/pull/8530. +- pdict["CONTENT-LENGTH"] = clength ++ key = _parseContentType(ctype) + if key == b"application/x-www-form-urlencoded": + args.update(parse_qs(self.content.read(), 1)) + elif key == mfd: + try: +- cgiArgs = cgi.parse_multipart( +- self.content, +- pdict, +- encoding="utf8", +- errors="surrogateescape", +- ) +- +- # The parse_multipart function on Python 3.7+ +- # decodes the header bytes as iso-8859-1 and +- # decodes the body bytes as utf8 with +- # surrogateescape -- we want bytes +- self.args.update( +- { +- x.encode("iso-8859-1"): [ +- z.encode("utf8", "surrogateescape") +- if isinstance(z, str) +- else z +- for z in y +- ] +- for x, y in cgiArgs.items() +- if isinstance(x, str) +- } +- ) +- except Exception as e: +- # It was a bad request, or we got a signal. ++ self.content.seek(0) ++ content = self.content.read() ++ self.args.update(_getMultiPartArgs(content, ctype)) ++ except _MultiPartParseException: ++ # It was a bad request. + self.channel._respondToBadRequestAndDisconnect() +- if isinstance(e, (TypeError, ValueError, KeyError)): +- return +- else: +- # If it's not a userspace error from CGI, reraise +- raise ++ return + + self.content.seek(0, 0) + +-- +2.43.0 + diff --git a/SOURCES/0005-Update-dis.findlinestarts-for-Python-3.13.patch b/SOURCES/0005-Update-dis.findlinestarts-for-Python-3.13.patch new file mode 100644 index 0000000..f1220af --- /dev/null +++ b/SOURCES/0005-Update-dis.findlinestarts-for-Python-3.13.patch @@ -0,0 +1,42 @@ +From 5a45846df7bc8cbc683b2b19ba11d20bb7f6fdf1 Mon Sep 17 00:00:00 2001 +From: Adi Roiban +Date: Tue, 16 Jan 2024 14:42:20 +0100 +Subject: [PATCH] Update dis.findlinestarts for Python 3.13 + +--- + src/twisted/python/deprecate.py | 6 +++++- + src/twisted/trial/_synctest.py | 1 + + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/twisted/python/deprecate.py b/src/twisted/python/deprecate.py +index c85b98d..08d37eb 100644 +--- a/src/twisted/python/deprecate.py ++++ b/src/twisted/python/deprecate.py +@@ -606,7 +606,11 @@ def warnAboutFunction(offender, warningString): + warningString, + category=DeprecationWarning, + filename=inspect.getabsfile(offenderModule), +- lineno=max(lineNumber for _, lineNumber in findlinestarts(offender.__code__)), ++ lineno=max( ++ lineNumber ++ for _, lineNumber in findlinestarts(offender.__code__) ++ if lineNumber is not None ++ ), + module=offenderModule.__name__, + registry=offender.__globals__.setdefault("__warningregistry__", {}), + module_globals=None, +diff --git a/src/twisted/trial/_synctest.py b/src/twisted/trial/_synctest.py +index 2cffc2c..8d8e9b1 100644 +--- a/src/twisted/trial/_synctest.py ++++ b/src/twisted/trial/_synctest.py +@@ -1192,6 +1192,7 @@ class SynchronousTestCase(_Assertions): + lineNumbers = [ + lineNumber + for _, lineNumber in _findlinestarts(aFunction.__code__) ++ if lineNumber is not None + ] + if not (min(lineNumbers) <= aWarning.lineno <= max(lineNumbers)): + continue +-- +2.43.0 + diff --git a/SOURCES/0006-fix-inlinecb-tests.patch b/SOURCES/0006-fix-inlinecb-tests.patch new file mode 100644 index 0000000..2d47ebf --- /dev/null +++ b/SOURCES/0006-fix-inlinecb-tests.patch @@ -0,0 +1,286 @@ +From e5473d7575dfe12c43fa0cc9ca80df22b276742f Mon Sep 17 00:00:00 2001 +From: eevelweezel +Date: Wed, 24 Jan 2024 22:00:31 -0600 +Subject: [PATCH 1/4] fix inlinecb tests + +--- + src/twisted/internet/test/test_inlinecb.py | 71 ++++++++++++++++++++++ + 1 file changed, 71 insertions(+) + +diff --git a/src/twisted/internet/test/test_inlinecb.py b/src/twisted/internet/test/test_inlinecb.py +index a8fcc77351d..1ab00df4230 100644 +--- a/src/twisted/internet/test/test_inlinecb.py ++++ b/src/twisted/internet/test/test_inlinecb.py +@@ -9,6 +9,8 @@ + well. + """ + ++import sys ++from unittest import skipIf + + from twisted.internet.defer import ( + CancelledError, +@@ -126,6 +128,7 @@ def inline(): + + + class ForwardTraceBackTests(SynchronousTestCase): ++ @skipIf(sys.version_info > (3, 12), 'applies to Python 3.12 and older') + def test_forwardTracebacks(self): + """ + Chained inlineCallbacks are forwarding the traceback information +@@ -150,6 +153,32 @@ def calling(): + self.assertIn("in calling", tb) + self.assertIn("Error Marker", tb) + ++ @skipIf(sys.version_info < (3, 13), 'new in Python 3.13') ++ def test_forwardTracebacks313(self): ++ """ ++ Chained inlineCallbacks are forwarding the traceback information ++ from generator to generator. ++ ++ A first simple test with a couple of inline callbacks. ++ """ ++ ++ @inlineCallbacks ++ def erroring(): ++ yield "forcing generator" ++ raise Exception("Error Marker") ++ ++ @inlineCallbacks ++ def calling(): ++ yield erroring() ++ ++ d = calling() ++ f = self.failureResultOf(d) ++ tb = f.getTraceback() ++ self.assertIn("yield erroring", tb) ++ self.assertIn("in calling", tb) ++ self.assertIn("Error Marker", tb) ++ ++ @skipIf(sys.version_info > (3, 12), 'applies to Python 3.12 and older') + def test_forwardLotsOfTracebacks(self): + """ + Several Chained inlineCallbacks gives information about all generators. +@@ -197,6 +226,48 @@ def calling(): + self.assertIn("Error Marker", tb) + self.assertIn("in erroring", f.getTraceback()) + ++ @skipIf(sys.version_info < (3, 13), 'new in Python 3.13') ++ def test_forwardLotsOfTracebacks313(self): ++ """ ++ Several Chained inlineCallbacks gives information about all generators. ++ ++ A wider test with a 4 chained inline callbacks. ++ ++ Note that the previous test is testing the simple case, and this one is ++ testing the deep recursion case. ++ ++ That case needs specific code in failure.py to accomodate to stack ++ breakage introduced by throwExceptionIntoGenerator. ++ ++ Hence we keep the two tests in order to sort out which code we ++ might have regression in. ++ """ ++ ++ @inlineCallbacks ++ def erroring(): ++ yield "forcing generator" ++ raise Exception("Error Marker") ++ ++ @inlineCallbacks ++ def calling3(): ++ yield erroring() ++ ++ @inlineCallbacks ++ def calling2(): ++ yield calling3() ++ ++ @inlineCallbacks ++ def calling(): ++ yield calling2() ++ ++ d = calling() ++ f = self.failureResultOf(d) ++ tb = f.getTraceback() ++ self.assertIn("in calling", tb) ++ self.assertIn("yield calling2", tb) ++ self.assertIn("throwExceptionIntoGenerator", tb) ++ self.assertIn("Error Marker", tb) ++ + + class UntranslatedError(Exception): + """ + +From 1545ecae0b73cbdf80a83816cb2cf7beb701c9ee Mon Sep 17 00:00:00 2001 +From: eevelweezel +Date: Wed, 24 Jan 2024 22:06:04 -0600 +Subject: [PATCH 2/4] add newsfragment + +--- + src/twisted/newsfragments/12061.misc | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 src/twisted/newsfragments/12061.misc + +diff --git a/src/twisted/newsfragments/12061.misc b/src/twisted/newsfragments/12061.misc +new file mode 100644 +index 00000000000..4880acc97d9 +--- /dev/null ++++ b/src/twisted/newsfragments/12061.misc +@@ -0,0 +1 @@ ++Make inline callback tests compatible with 3.13. + +From 0e5b1896b99cddcab47ed0f7963837a3242f8a3e Mon Sep 17 00:00:00 2001 +From: eevelweezel +Date: Wed, 24 Jan 2024 22:33:26 -0600 +Subject: [PATCH 3/4] fix tests in light of codecoverage + +--- + src/twisted/internet/test/test_inlinecb.py | 82 +--------------------- + 1 file changed, 3 insertions(+), 79 deletions(-) + +diff --git a/src/twisted/internet/test/test_inlinecb.py b/src/twisted/internet/test/test_inlinecb.py +index 1ab00df4230..2efdd68d2d2 100644 +--- a/src/twisted/internet/test/test_inlinecb.py ++++ b/src/twisted/internet/test/test_inlinecb.py +@@ -9,8 +9,6 @@ + well. + """ + +-import sys +-from unittest import skipIf + + from twisted.internet.defer import ( + CancelledError, +@@ -128,7 +126,6 @@ def inline(): + + + class ForwardTraceBackTests(SynchronousTestCase): +- @skipIf(sys.version_info > (3, 12), 'applies to Python 3.12 and older') + def test_forwardTracebacks(self): + """ + Chained inlineCallbacks are forwarding the traceback information +@@ -149,89 +146,17 @@ def calling(): + d = calling() + f = self.failureResultOf(d) + tb = f.getTraceback() +- self.assertIn("in erroring", tb) ++ self.assertIn("erroring", tb) + self.assertIn("in calling", tb) + self.assertIn("Error Marker", tb) + +- @skipIf(sys.version_info < (3, 13), 'new in Python 3.13') +- def test_forwardTracebacks313(self): +- """ +- Chained inlineCallbacks are forwarding the traceback information +- from generator to generator. +- +- A first simple test with a couple of inline callbacks. +- """ +- +- @inlineCallbacks +- def erroring(): +- yield "forcing generator" +- raise Exception("Error Marker") +- +- @inlineCallbacks +- def calling(): +- yield erroring() +- +- d = calling() +- f = self.failureResultOf(d) +- tb = f.getTraceback() +- self.assertIn("yield erroring", tb) +- self.assertIn("in calling", tb) +- self.assertIn("Error Marker", tb) +- +- @skipIf(sys.version_info > (3, 12), 'applies to Python 3.12 and older') + def test_forwardLotsOfTracebacks(self): + """ + Several Chained inlineCallbacks gives information about all generators. + + A wider test with a 4 chained inline callbacks. + +- Application stack-trace should be reported, and implementation details +- like "throwExceptionIntoGenerator" symbols are omitted from the stack. +- +- Note that the previous test is testing the simple case, and this one is +- testing the deep recursion case. +- +- That case needs specific code in failure.py to accomodate to stack +- breakage introduced by throwExceptionIntoGenerator. +- +- Hence we keep the two tests in order to sort out which code we +- might have regression in. +- """ +- +- @inlineCallbacks +- def erroring(): +- yield "forcing generator" +- raise Exception("Error Marker") +- +- @inlineCallbacks +- def calling3(): +- yield erroring() +- +- @inlineCallbacks +- def calling2(): +- yield calling3() +- +- @inlineCallbacks +- def calling(): +- yield calling2() +- +- d = calling() +- f = self.failureResultOf(d) +- tb = f.getTraceback() +- self.assertIn("in erroring", tb) +- self.assertIn("in calling", tb) +- self.assertIn("in calling2", tb) +- self.assertIn("in calling3", tb) +- self.assertNotIn("throwExceptionIntoGenerator", tb) +- self.assertIn("Error Marker", tb) +- self.assertIn("in erroring", f.getTraceback()) +- +- @skipIf(sys.version_info < (3, 13), 'new in Python 3.13') +- def test_forwardLotsOfTracebacks313(self): +- """ +- Several Chained inlineCallbacks gives information about all generators. +- +- A wider test with a 4 chained inline callbacks. ++ Application stack-trace should be reported. + + Note that the previous test is testing the simple case, and this one is + testing the deep recursion case. +@@ -264,8 +189,7 @@ def calling(): + f = self.failureResultOf(d) + tb = f.getTraceback() + self.assertIn("in calling", tb) +- self.assertIn("yield calling2", tb) +- self.assertIn("throwExceptionIntoGenerator", tb) ++ self.assertIn("calling2", tb) + self.assertIn("Error Marker", tb) + + + +From 6376bbc5193ec055ec4abcc3b13da8b3934f652a Mon Sep 17 00:00:00 2001 +From: eevelweezel +Date: Wed, 24 Jan 2024 22:47:16 -0600 +Subject: [PATCH 4/4] typo + +--- + src/twisted/internet/test/test_inlinecb.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/twisted/internet/test/test_inlinecb.py b/src/twisted/internet/test/test_inlinecb.py +index 2efdd68d2d2..3983767a464 100644 +--- a/src/twisted/internet/test/test_inlinecb.py ++++ b/src/twisted/internet/test/test_inlinecb.py +@@ -154,7 +154,7 @@ def test_forwardLotsOfTracebacks(self): + """ + Several Chained inlineCallbacks gives information about all generators. + +- A wider test with a 4 chained inline callbacks. ++ A wider test with 4 chained inline callbacks. + + Application stack-trace should be reported. + diff --git a/SOURCES/0009-Account-with-the-new-traceback-pointing-characters.patch b/SOURCES/0009-Account-with-the-new-traceback-pointing-characters.patch new file mode 100644 index 0000000..f269dde --- /dev/null +++ b/SOURCES/0009-Account-with-the-new-traceback-pointing-characters.patch @@ -0,0 +1,24 @@ +From dba8a12453f55ff783ed43d0b4b11163a828bc86 Mon Sep 17 00:00:00 2001 +From: Karolina Surma +Date: Tue, 30 Jan 2024 14:51:32 +0100 +Subject: [PATCH] Account with the new traceback pointing characters + +--- + src/twisted/web/test/test_flatten.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/twisted/web/test/test_flatten.py b/src/twisted/web/test/test_flatten.py +index effe153..d05d032 100644 +--- a/src/twisted/web/test/test_flatten.py ++++ b/src/twisted/web/test/test_flatten.py +@@ -655,6 +655,7 @@ class FlattenerErrorTests(SynchronousTestCase): + "Exception while flattening:\n" + ' File "%s", line %d, in f\n' + " g()\n" ++ ' ~^^\n' + ' File "%s", line %d, in g\n' + ' raise RuntimeError("reason")\n' + "RuntimeError: reason\n" +-- +2.43.0 + diff --git a/SOURCES/0010-Skip-failing-tests.patch b/SOURCES/0010-Skip-failing-tests.patch new file mode 100644 index 0000000..2983bdf --- /dev/null +++ b/SOURCES/0010-Skip-failing-tests.patch @@ -0,0 +1,91 @@ +From 6727de0ec58892c32ae848b17f799fc4ee80de68 Mon Sep 17 00:00:00 2001 +From: Karolina Surma +Date: Mon, 3 Jun 2024 13:39:29 +0200 +Subject: [PATCH] Work around the test_flatten failures + +--- + src/twisted/test/test_failure.py | 4 +++- + src/twisted/web/_flatten.py | 3 ++- + src/twisted/web/test/test_cgi.py | 2 ++ + src/twisted/web/test/test_flatten.py | 2 ++ + 4 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/src/twisted/test/test_failure.py b/src/twisted/test/test_failure.py +index 10d9542..9feb74a 100644 +--- a/src/twisted/test/test_failure.py ++++ b/src/twisted/test/test_failure.py +@@ -16,7 +16,7 @@ from io import StringIO + from traceback import FrameSummary + from types import TracebackType + from typing import Any, Generator +-from unittest import skipIf ++from unittest import skipIf, skip + + try: + from cython_test_exception_raiser import raiser # type: ignore[import] +@@ -942,6 +942,8 @@ class ExtendedGeneratorTests(SynchronousTestCase): + + self.assertEqual(traceback.extract_tb(stuff[0][2])[-1][-1], "1 / 0") + ++ ++ @skip("Fails with Python 3.13") + def test_findFailureInGenerator(self) -> None: + """ + Within an exception handler, it should be possible to find the +diff --git a/src/twisted/web/_flatten.py b/src/twisted/web/_flatten.py +index 87a8bf2..b8daad6 100644 +--- a/src/twisted/web/_flatten.py ++++ b/src/twisted/web/_flatten.py +@@ -432,7 +432,8 @@ async def _flattenTree( + roots = [] + for generator in stack: + roots.append(generator.gi_frame.f_locals["root"]) +- roots.append(frame.f_locals["root"]) ++ if "root" in frame.f_locals: ++ roots.append(frame.f_locals["root"]) + raise FlattenerError(e, roots, extract_tb(exc_info()[2])) + else: + stack.append(element) +diff --git a/src/twisted/web/test/test_cgi.py b/src/twisted/web/test/test_cgi.py +index 7d546b5..43e2cd9 100644 +--- a/src/twisted/web/test/test_cgi.py ++++ b/src/twisted/web/test/test_cgi.py +@@ -9,6 +9,7 @@ import json + import os + import sys + from io import BytesIO ++from unittest import skip + + from twisted.internet import address, error, interfaces, reactor + from twisted.internet.error import ConnectionLost +@@ -369,6 +370,7 @@ class CGIScriptTests(_StartServerAndTearDownMixin, unittest.TestCase): + Tests for L{twcgi.CGIScript}. + """ + ++ @skip("Fails with Python 3.13") + def test_urlParameters(self): + """ + If the CGI script is passed URL parameters, do not fall over, +diff --git a/src/twisted/web/test/test_flatten.py b/src/twisted/web/test/test_flatten.py +index d05d032..60a27c4 100644 +--- a/src/twisted/web/test/test_flatten.py ++++ b/src/twisted/web/test/test_flatten.py +@@ -13,6 +13,7 @@ from collections import OrderedDict + from textwrap import dedent + from types import FunctionType + from typing import Callable, Dict, List, NoReturn, Optional, Tuple, cast ++from unittest import skip + from xml.etree.ElementTree import XML + + from zope.interface import implementer +@@ -667,6 +668,7 @@ class FlattenerErrorTests(SynchronousTestCase): + ), + ) + ++ @skip("Fails with Python 3.13") + def test_asynchronousFlattenError(self) -> None: + """ + When flattening a renderer which raises an exception asynchronously, +-- +2.44.0 + diff --git a/SOURCES/12064.patch b/SOURCES/12064.patch new file mode 100644 index 0000000..4c2fc52 --- /dev/null +++ b/SOURCES/12064.patch @@ -0,0 +1,97 @@ +From eb0e435dae182363500c3e291f757a24b9df2e9d Mon Sep 17 00:00:00 2001 +From: Adi Roiban +Date: Thu, 21 Dec 2023 09:18:42 +0000 +Subject: [PATCH] Initial update for deprecation helpers. + +--- + src/twisted/newsfragments/12063.removal | 2 ++ + src/twisted/python/deprecate.py | 8 +++++- + src/twisted/python/test/test_deprecate.py | 30 +++++++++-------------- + 3 files changed, 21 insertions(+), 19 deletions(-) + create mode 100644 src/twisted/newsfragments/12063.removal + +diff --git a/src/twisted/newsfragments/12063.removal b/src/twisted/newsfragments/12063.removal +new file mode 100644 +index 00000000000..7958fc00d6e +--- /dev/null ++++ b/src/twisted/newsfragments/12063.removal +@@ -0,0 +1,2 @@ ++twisted.python.deprecate helper function will now always strip the docstrings. ++This is done to have the same behaviour as with Python 3.13. +diff --git a/src/twisted/python/deprecate.py b/src/twisted/python/deprecate.py +index c85b98d6272..ffc2103a65c 100644 +--- a/src/twisted/python/deprecate.py ++++ b/src/twisted/python/deprecate.py +@@ -258,8 +258,14 @@ def _appendToDocstring(thingWithDoc, textToAppend): + elif len(docstringLines) == 1: + docstringLines.extend(["", textToAppend, ""]) + else: +- spaces = docstringLines.pop() ++ trailer = docstringLines[-1] ++ spaces = "" ++ if not trailer.strip(): ++ # On Python 3.13 the docstring is already stripped. ++ # For older Python version we keep the trailer. ++ spaces = docstringLines.pop() + docstringLines.extend(["", spaces + textToAppend, spaces]) ++ docstringLines = [l.lstrip(" ") for l in docstringLines] + thingWithDoc.__doc__ = "\n".join(docstringLines) + + +diff --git a/src/twisted/python/test/test_deprecate.py b/src/twisted/python/test/test_deprecate.py +index ff3b21cb469..fc91e1f22b4 100644 +--- a/src/twisted/python/test/test_deprecate.py ++++ b/src/twisted/python/test/test_deprecate.py +@@ -876,12 +876,11 @@ def test_deprecatedReplacement(self): + self.assertEqual( + dummy.__doc__, + "\n" +- " Do nothing.\n\n" +- " This is used to test the deprecation decorators.\n\n" +- " Deprecated in Twisted 8.0.0; please use " ++ "Do nothing.\n\n" ++ "This is used to test the deprecation decorators.\n\n" ++ "Deprecated in Twisted 8.0.0; please use " + "something.foobar" +- " instead.\n" +- " ", ++ " instead.\n", + ) + + def test_deprecatedReplacementWithCallable(self): +@@ -897,11 +896,10 @@ def test_deprecatedReplacementWithCallable(self): + self.assertEqual( + dummy.__doc__, + "\n" +- " Do nothing.\n\n" +- " This is used to test the deprecation decorators.\n\n" +- " Deprecated in Twisted 8.0.0; please use " +- "%s.dummyReplacementMethod instead.\n" +- " " % (__name__,), ++ "Do nothing.\n\n" ++ "This is used to test the deprecation decorators.\n\n" ++ "Deprecated in Twisted 8.0.0; please use " ++ "{}.dummyReplacementMethod instead.\n".format(__name__), + ) + + def test_deprecatedKeywordParameter(self): +@@ -993,15 +991,11 @@ def multiLineDocstring(): + This is a multi-line docstring. + """ + +- def expectedDocstring(): +- """ +- This is a multi-line docstring. +- +- Appended text. +- """ +- + _appendToDocstring(multiLineDocstring, "Appended text.") +- self.assertEqual(expectedDocstring.__doc__, multiLineDocstring.__doc__) ++ self.assertEqual( ++ "\n" "This is a multi-line docstring.\n" "\n" "Appended text.\n", ++ multiLineDocstring.__doc__, ++ ) + + + class MutualArgumentExclusionTests(SynchronousTestCase): diff --git a/SOURCES/12066.patch b/SOURCES/12066.patch new file mode 100644 index 0000000..b93110a --- /dev/null +++ b/SOURCES/12066.patch @@ -0,0 +1,34 @@ +From f0b39dae0a02138a21eaa1f280b1be7cb7f1ff3c Mon Sep 17 00:00:00 2001 +From: Adi Roiban +Date: Thu, 21 Dec 2023 10:05:32 +0000 +Subject: [PATCH] Update twisted.python._shellcomp.ZshArgumentsGenerator for + Python 3.13. + +--- + src/twisted/newsfragments/12065.feature | 1 + + src/twisted/python/_shellcomp.py | 4 +++- + 2 files changed, 4 insertions(+), 1 deletion(-) + create mode 100644 src/twisted/newsfragments/12065.feature + +diff --git a/src/twisted/newsfragments/12065.feature b/src/twisted/newsfragments/12065.feature +new file mode 100644 +index 00000000000..4b9b4b2f07c +--- /dev/null ++++ b/src/twisted/newsfragments/12065.feature +@@ -0,0 +1 @@ ++twisted.python._shellcomp.ZshArgumentsGenerator was updated for Python 3.13. +diff --git a/src/twisted/python/_shellcomp.py b/src/twisted/python/_shellcomp.py +index e36620210b2..9c9a46a8d42 100644 +--- a/src/twisted/python/_shellcomp.py ++++ b/src/twisted/python/_shellcomp.py +@@ -603,7 +603,9 @@ def getDescription(self, longname): + obj = getattr(self.options, "opt_%s" % longMangled, None) + if obj is not None: + descr = descrFromDoc(obj) +- if descr is not None: ++ # On Python3.13 we have an empty string instead of None, ++ # for missing description. ++ if descr: + return descr + + return longname # we really ought to have a good description to use diff --git a/SPECS/python-twisted.spec b/SPECS/python-twisted.spec new file mode 100644 index 0000000..12ecf47 --- /dev/null +++ b/SPECS/python-twisted.spec @@ -0,0 +1,560 @@ +## START: Set by rpmautospec +## (rpmautospec version 0.6.3) +## RPMAUTOSPEC: autorelease, autochangelog +%define autorelease(e:s:pb:n) %{?-p:0.}%{lua: + release_number = 7; + base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); + print(release_number + base_release_number - 1); +}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} +## END: Set by rpmautospec + +%global srcname twisted + +%global common_description %{expand: +Twisted is a networking engine written in Python, supporting numerous protocols. +It contains a web server, numerous chat clients, chat servers, mail servers +and more.} + +Name: python-%{srcname} +Version: 23.10.0 +Release: %autorelease +Summary: Twisted is a networking engine written in Python + +License: MIT +URL: http://twistedmatrix.com/ +VCS: https://github.com/twisted/twisted +Source0: %vcs/archive/%{srcname}-%{version}/%{srcname}-%{version}.tar.gz +# https://github.com/twisted/twisted/pull/12027 +# https://github.com/twisted/twisted/issues/12026 +Patch1: 0001-Adjust-to-deprecation-of-3-arg-signature-of-generato.patch +# downstream-only fix tests, skip network tests that fail in buildsys +Patch2: 0002-23.10.0-fix-and-skip-tests-fedora.patch +# https://github.com/twisted/twisted/issues/12052 +# https://github.com/twisted/twisted/pull/12054 +Patch3: 0003-python3.12.1.patch + +# Three backported upstream commits to remove cgi module (removed from Python 3.13) +# https://github.com/twisted/twisted/commit/e6bf82b0a703e4bc78934d +# https://github.com/twisted/twisted/commit/2bceedc79f86c750f27432 +# https://github.com/twisted/twisted/commit/4579398f6b089f93181ba2 +Patch4: 0004-Remove-the-usage-of-cgi.parse_multipart.patch + +# In Python 3.13 line numbers returned by findlinestarts +# can be None for bytecode that does not map to source lines. +# https://github.com/twisted/twisted/pull/12059 +Patch5: 0005-Update-dis.findlinestarts-for-Python-3.13.patch + +# Fix inlineCallbacks tests on Python 3.13 +# https://github.com/twisted/twisted/pull/12092 +Patch6: 0006-fix-inlinecb-tests.patch + +# Fix stripped indentation (change of behaviour with Python 3.13) +Patch7: https://github.com/twisted/twisted/pull/12064.patch + +# Update twisted.python._shellcomp.ZshArgumentsGenerator for Python 3.13 +# Merged upstream: https://github.com/twisted/twisted/pull/12066 +Patch8: https://github.com/twisted/twisted/pull/12066.patch + +# Reported: https://github.com/twisted/twisted/issues/12098 +Patch9: 0009-Account-with-the-new-traceback-pointing-characters.patch + +# With Python 3.13.0b1 there are issues with test_flatten +# https://github.com/twisted/twisted/issues/12194 +# Skip the last failing tests, reported: +# https://github.com/twisted/twisted/issues/12099 +Patch10: 0010-Skip-failing-tests.patch + +BuildArch: noarch + +%description %{common_description} + +%package -n python3-%{srcname} +Summary: %{summary} + +BuildRequires: python3-devel >= 3.3 +BuildRequires: python3-pyasn1-modules, python3-cryptography, python3-pynacl +BuildRequires: python3-service-identity, python3-pyOpenSSL, python3-h2 +BuildRequires: python3-bcrypt, python3-subunit +BuildRequires: python3-hamcrest, python3-hypothesis +BuildRequires: git-core + +Recommends: python3-%{srcname}+tls + +%description -n python3-%{srcname} %{common_description} + +%pyproject_extras_subpkg -n python3-%{srcname} tls + + +%prep +%autosetup -p1 -n %{srcname}-%{srcname}-%{version} + +%generate_buildrequires +%pyproject_buildrequires + + +%build +%pyproject_wheel + + +%install +%pyproject_install + +# no-manual-page-for-binary +mkdir -p %{buildroot}%{_mandir}/man1/ +for s in conch core mail; do +cp -a docs/$s/man/*.1 %{buildroot}%{_mandir}/man1/ +done + +# Packages that install arch-independent twisted plugins install here. +# https:# bugzilla.redhat.com/show_bug.cgi?id=1252140 +mkdir -p %{buildroot}%{python3_sitelib}/twisted/plugins + +# Move and symlink python3 scripts +ln -s ./trial %{buildroot}%{_bindir}/trial-3 +ln -s ./twistd %{buildroot}%{_bindir}/twistd-3 + +%pyproject_save_files %{srcname} +echo "%ghost %{python3_sitelib}/twisted/plugins/dropin.cache" >> %{pyproject_files} + + +%check +PATH=%{buildroot}%{_bindir}:$PATH PYTHONPATH=$PWD/src %{buildroot}%{_bindir}/trial twisted + + +%files -n python3-twisted -f %{pyproject_files} +%doc NEWS.rst README.rst +%license LICENSE +%{_bindir}/cftp +%{_bindir}/ckeygen +%{_bindir}/conch +%{_bindir}/mailmail +%{_bindir}/pyhtmlizer +%{_bindir}/tkconch +%{_bindir}/trial +%{_bindir}/twist +%{_bindir}/twistd +%{_bindir}/trial-3 +%{_bindir}/twistd-3 +%{_mandir}/man1/cftp.1* +%{_mandir}/man1/ckeygen.1* +%{_mandir}/man1/conch.1* +%{_mandir}/man1/mailmail.1* +%{_mandir}/man1/pyhtmlizer.1* +%{_mandir}/man1/tkconch.1* +%{_mandir}/man1/trial.1* +%{_mandir}/man1/twistd.1* + + +%changelog +* Sun Jan 05 2025 Arkady L. Shane - 23.10.0-7 +- Rebuilt for MSVSphere 10 + +## START: Generated by rpmautospec +* Sun Jun 09 2024 Python Maint - 23.10.0-7 +- Rebuilt for Python 3.13 + +* Mon Jun 03 2024 Karolina Surma - 23.10.0-6 +- Make twisted build with Python 3.13 + +* Tue Jan 16 2024 Karolina Surma - 23.10.0-4 +- Update dis.findlinestarts for Python 3.13 + +* Tue Jan 16 2024 Karolina Surma - 23.10.0-3 +- Remove the usage of cgi module (removed in Python 3.13) + +* Wed Dec 20 2023 Miro Hrončok - 23.10.0-2 +- Fix tests failures with Python 3.12.1+ + +* Wed Nov 01 2023 Jonathan Steffan - 23.10.0-1 +- Update to 23.10.0 + +* Sat Oct 28 2023 Adam Williamson - 23.8.0-4 +- Update comment for patch4 as I submitted the PR + +* Sat Oct 28 2023 Adam Williamson - 23.8.0-3 +- Patch to not use deprecated form of generator.throw() + +* Mon Aug 28 2023 Jonathan Steffan - 23.8.0-2 +- Update to Update to 23.8.0 +- Closes RHBZ#2235436 + +* Tue Aug 22 2023 Jonathan Steffan - 23.8.0-0.1.rc1 +- Update to 23.8.0rc1 +- Closes RHBZ#2232681 + +* Fri Jul 21 2023 Fedora Release Engineering - 22.10.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Jun 28 2023 Miro Hrončok - 22.10.0-6 +- Backport trivial upstream's imp->importlib update + +* Wed Jun 28 2023 Miro Hrončok - 22.10.0-5 +- Cowardly skip tests that fail/error/hang with Python 3.12 + +* Thu Jun 15 2023 Python Maint - 22.10.0-4 +- Rebuilt for Python 3.12 + +* Wed Apr 05 2023 Carl George - 22.10.0-3 +- Fix attrs import error on EPEL9 +- Resolves: rhbz#2182954 +- Enforce tests + +* Fri Jan 20 2023 Fedora Release Engineering - 22.10.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Wed Dec 28 2022 Robert-André Mauchin - 22.10.0-1 +- Update to 22.10.0 + +* Fri Jul 22 2022 Fedora Release Engineering - 22.4.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Sun Jul 03 2022 Robert-André Mauchin - 22.4.0-2 +- Remove commented BuildRequires + +* Thu Jun 23 2022 Robert-André Mauchin - 22.4.0-1 +- Update to 22.4.0 Close: rhbz#2046562 rhbz#2073115 rhbz#2060972 + rhbz#2059508 + +* Tue Jun 14 2022 Python Maint - 21.7.0-6 +- Rebuilt for Python 3.11 + +* Fri Jan 21 2022 Fedora Release Engineering - 21.7.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Mon Dec 20 2021 Miro Hrončok - 21.7.0-4 +- Use PEP 503 names for BuildRequires + +* Mon Dec 20 2021 Robert-André Mauchin - 21.7.0-3 +- Reapply patch importing gobject from gi.repository + +* Sun Aug 01 2021 Robert-André Mauchin - 21.7.0-2 +- Fix minimum version for incremental. Fix: rhbz#1988712 + +* Sat Jul 31 2021 Robert-André Mauchin - 21.7.0-1 +- Update to 21.7.0 Close: rhbz#1988076 + +* Fri Jul 30 2021 Robert-André Mauchin - 21.2.0-6 +- Fix FTBFS Close: rhbz#1988076 + +* Tue Jul 27 2021 Fedora Release Engineering - 21.2.0-4 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 21.2.0-3 +- Rebuilt for Python 3.10 + +* Fri Mar 05 2021 Miro Hrončok - 21.2.0-2 +- Reintroduce twisted[tls] subpackage +- Fixes: rhbz#1935872 +- Fixes: rhbz#1935873 +- Fixes: rhbz#1935869 +- Fixes: rhbz#1935870 +- Fixes: rhbz#1935871 + +* Fri Mar 5 09:54:54 CET 2021 Robert-André Mauchin - 21.2.0-1 +- Update to 21.2.0 + +* Wed Jan 27 2021 Fedora Release Engineering - 20.3.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sun Dec 20 2020 Robert-André Mauchin - 20.3.0-4 +- Bump h2 dependency +- Fix: rhbz#1909413 + +* Wed Jul 29 2020 Fedora Release Engineering - 20.3.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Fri Jul 10 2020 Miro Hrončok - 20.3.0-2 +- Add twisted[tls] subpackage + +* Thu Jun 18 05:29:03 CEST 2020 Robert-André Mauchin - 20.3.0-1 +- Update to 20.3.0 + +* Sun May 24 2020 Miro Hrončok - 19.10.0-3 +- Rebuilt for Python 3.9 + +* Tue Mar 17 16:31:05 CET 2020 Robert-André Mauchin - 19.10.0-2 +- Security fix for CVE-2020-10108 (#1813439, #1813441) +- Security fix for CVE-2020-10109 (#1813447, #1813449) + +* Tue Mar 17 15:15:48 CET 2020 Robert-André Mauchin - 19.10.0-1 +- Update to 19.10.0 +- Revert removal of %%{python3_sitelib}/twisted/plugins/ + +* Sun Oct 13 23:35:33 CEST 2019 Robert-André Mauchin - 19.7.0-2 +- Drop Python 2 support (#1761204) + +* Mon Sep 16 2019 Jeremy Cline - 19.7.0-1 +- Update to 19.7.0 + +* Tue Sep 03 2019 Miro Hrončok - 19.2.1-6 +- Stop running Python 2 tests at build time, reduce the build dependencies + +* Sat Aug 17 2019 Miro Hrončok - 19.2.1-5 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 19.2.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Tue Jul 09 2019 Miro Hrončok - 19.2.1-3 +- Security fix for CVE-2019-12855 (Check certificates for XMPP TLS) (#1728206) (#1728207) + +* Wed Jul 03 2019 Miro Hrončok - 19.2.1-2 +- Rebuilt to update automatic Python dependencies + +* Sun Jun 09 18:40:31 CEST 2019 Robert-André Mauchin - 19.2.1-1 +- Release 19.2.1 + +* Wed May 22 18:26:29 CEST 2019 Robert-André Mauchin - 19.2.0-3 +- Add patch to import gobject from gi.repository for Python 3 +- Fix #1712748 + +* Tue May 14 16:00:42 CEST 2019 Robert-André Mauchin - 19.2.0-2 +- Add patch regenerating raiser.c to use with Python 3.8a4 +- Fix #11709817 + +* Wed Apr 10 17:38:50 CET 2019 Robert-André Mauchin - 19.2.0-1 +- Release 19.2.0 (#1698490) + +* Thu Mar 07 2019 Robert-André Mauchin - 18.9.0-1 +- Release 18.9.0 +- Run tests + +* Sat Feb 02 2019 Fedora Release Engineering - 18.7.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Oct 22 2018 Miro Hrončok - 18.7.0-3 +- Recommend pythonX-service-identity + +* Sat Jul 21 2018 Robert-André Mauchin - 18.7.0-2 +- Remove erroneous symlink to binaries + +* Sun Jul 15 2018 Robert-André Mauchin - 18.7.0-1 +- Update to 18.7.0 + +* Sat Jul 14 2018 Fedora Release Engineering - 18.4.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Jun 27 2018 Robert-André Mauchin - 18.4.0-1 +- Update to 18.4.0 +- Default binaries to Python 3 +- Drop old Obsoletes/Provides +- Refresh BR +- Remove useless macros +- Use python_enable_dependency_generator + +* Mon Jun 18 2018 Miro Hrončok - 16.4.1-11 +- Rebuilt for Python 3.7 + +* Wed May 23 2018 Miro Hrončok - 16.4.1-10 +- Fix ambiguous shebangs + +* Fri Apr 27 2018 Petr Viktorin - 16.4.1-9 +- No longer require python-crypto + +* Mon Mar 26 2018 Iryna Shcherbina - 16.4.1-8 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Fri Feb 09 2018 Fedora Release Engineering - 16.4.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Sep 29 2017 Troy Dawson - 16.4.1-6 +- Cleanup spec file conditionals + +* Thu Aug 03 2017 Fedora Release Engineering - 16.4.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 16.4.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 16.4.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Dec 13 2016 Stratakis Charalampos - 16.4.1-2 +- rebuilt + +* Wed Oct 26 2016 Jonathan Steffan - 16.4.1-1 +- Update to 16.4.1 + +* Tue Jul 19 2016 Fedora Release Engineering - 16.3.0-2 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Fri Jul 8 2016 Jonathan Steffan - 16.3.0-1 +- Update to 16.3.0 +- mahole, tap2deb, tap2rpm are removed upstream + +* Sun Jun 26 2016 Jonathan Steffan - 16.2.0-2 +- Add rpmlint notes +- Fix unneeded py3 conditional for py2 script chmod + +* Sun Jun 26 2016 Jonathan Steffan - 16.2.0-1 +- Update to 16.2.0 +- Update upstream source location + +* Thu Jun 2 2016 Haïkel Guémar - 16.1.1-3 +- Drop tkinter dependency (only required for tkconch) +- Use python3 conditionals +- Move BR under the proper subpackage + +* Tue May 10 2016 Petr Viktorin - 16.1.1-2 +- Update to better conform to Python packaging guidelines + +* Thu May 05 2016 Julien Enselme - 16.1.1-1 +- Update to 16.1.1 (#1287381) + +* Thu Mar 10 2016 Julien Enselme - 15.5.0-2 +- Add python3 support + +* Thu Mar 10 2016 Julien Enselme - 15.5.0-1 +- Update to 15.5.0 (#1287381) +- Use new python macros +- Remove deprecated %%clean section + +* Thu Feb 04 2016 Fedora Release Engineering - 15.4.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Nov 27 2015 Tom Prince - 15.4.0-2 +- Add arch-independent plugin directory to package. (RHBZ#1252140) + +* Thu Oct 29 2015 Tom Prince - 15.4.0-1 +- Update to 15.4.0 +- Include test certificates. + +* Mon Jul 20 2015 Jonathan Steffan - 15.2.1-1 +- Update to 15.2.1 + +* Sat May 09 2015 Jonathan Steffan - 15.1.0-1 +- Update to 15.1.0 (RHBZ#1187921,RHBZ#1192707) +- Require python-service-identity (RHBZ#1119067) +- Obsolete python-twisted-core-doc (RHBZ#1187025) + +* Sat Nov 22 2014 Jonathan Steffan - 14.0.2-1 +- Update to 14.0.2 (RHBZ#1143002) + +* Sun Aug 17 2014 Fedora Release Engineering - 14.0.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Jonathan Steffan - 14.0.0-1 +- Update to 14.0.0 +- Ship Twisted as a fully featured package without subpackages on the advice + of upstream and to mirror what pypi provides +- Explictly build for python2 with new macros + +* Sat Jun 07 2014 Fedora Release Engineering - 12.2.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 12.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 12.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Mon Sep 03 2012 Julian Sikorski - 12.2.0-1 +- Updated to 12.2.0 + +* Sat Jul 21 2012 Fedora Release Engineering - 12.1.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sun Jun 17 2012 Julian Sikorski - 12.1.0-1 +- Updated to 12.1.0 + +* Sun Feb 12 2012 Julian Sikorski - 12.0.0-1 +- Updated to 12.0.0 + +* Sat Jan 07 2012 Julian Sikorski - 11.1.0-2 +- Rebuilt for gcc-4.7 + +* Fri Nov 18 2011 Julian Sikorski - 11.1.0-1 +- Updated to 11.1.0 +- Dropped obsolete Group, Buildroot, %%clean and %%defattr + +* Sat Apr 30 2011 Julian Sikorski - 11.0.0-1 +- Updated to 11.0.0 +- Added comment on how to obtain the PKG-INFO file + +* Wed Feb 09 2011 Fedora Release Engineering - 10.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sat Jan 15 2011 Julian Sikorski - 10.2.0-1 +- Updated to 10.2.0 + +* Mon Nov 08 2010 Julian Sikorski - 10.1.0-3 +- Use python_sitelib instead of python-sitearch +- The aforementioned macros are defined in Fedora 13 and above + +* Sun Nov 07 2010 Julian Sikorski - 10.1.0-2 +- Added egg-info file + +* Tue Sep 21 2010 Julian Sikorski - 10.1.0-1 +- Updated to 10.1.0 +- Switched to macros for versioned dependencies + +* Sun Jul 26 2009 Fedora Release Engineering - 8.2.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Feb 26 2009 Fedora Release Engineering - 8.2.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Dec 29 2008 Matthias Saou 8.2.0-1 +- Update to 8.2.0. +- Change back spec cosmetic details from Paul's to Thomas' preference. + +* Wed Jul 16 2008 Matthias Saou 8.1.0-2 +- Update to 8.1.0. +- Minor spec file cleanups. +- Merge back changes from Paul Howarth. + +* Wed May 21 2008 Thomas Vander Stichele +- 2.5.0-1 +- update to 2.5.0 release (only the umbrella package was missing) + +* Tue Jan 16 2007 Thomas Vander Stichele +- 2.4.0-3 +- list packages in README.fedora + +* Wed Jan 03 2007 Thomas Vander Stichele +- 2.4.0-2 +- add a README.fedora +- made noarch, since it doesn't actually install any python twisted/ module + code +- fixed provides/obsoletes + +* Wed Jun 07 2006 Thomas Vander Stichele +- 2.4.0-1 +- this is now a pure umbrella package + +* Mon Oct 10 2005 Jeff Pitman 2.1.0-1 +- upstream release + +* Tue Aug 23 2005 Jeff Pitman 2.0.1-1 +- upstream release + +* Mon Apr 04 2005 Jeff Pitman 2.0.0-2 +- add zsh support + +* Fri Mar 25 2005 Jeff Pitman 2.0.0-1 +- final release + +* Thu Mar 17 2005 Jeff Pitman 2.0.0-0.2.a3 +- dropped web2 + +* Wed Mar 16 2005 Jeff Pitman 2.0.0-0.1.a3 +- upstream release + +* Sat Mar 12 2005 Jeff Pitman 2.0.0-0.1.a2 +- new prerelease; FE versioning + +* Mon Feb 07 2005 Jeff Pitman 2.0.0a1-1 +- prep for split + +* Fri Aug 20 2004 Jeff Pitman 1.3.0-1 +- new version + +* Mon Apr 19 2004 Jeff Pitman 1.2.0-3 +- vaultize + +* Mon Apr 12 2004 Jeff Pitman 1.2.0-2 +- require pyOpenSSL, SOAPpy, openssh-clients, crypto, dia so trial can run + +## END: Generated by rpmautospec