forked from pool/python-Twisted
- Make the libalternatives transition conditional
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=162
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
||||
64
1521_delegate_parseqs_stdlib_bpo42967.patch
Normal file
64
1521_delegate_parseqs_stdlib_bpo42967.patch
Normal file
@@ -0,0 +1,64 @@
|
||||
From 7130df7ee21ebd93d7e15e7c4ef752b759f8e1c3 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Grainger <tagrain@gmail.com>
|
||||
Date: Sun, 21 Feb 2021 11:54:25 +0000
|
||||
Subject: [PATCH] delegate to stdlib parse qs
|
||||
|
||||
---
|
||||
src/twisted/web/http.py | 29 +---------------------
|
||||
src/twisted/web/newsfragments/10096.bugfix | 1 +
|
||||
2 files changed, 2 insertions(+), 28 deletions(-)
|
||||
create mode 100644 src/twisted/web/newsfragments/10096.bugfix
|
||||
|
||||
Index: twisted-24.10.0/src/twisted/web/http.py
|
||||
===================================================================
|
||||
--- twisted-24.10.0.orig/src/twisted/web/http.py
|
||||
+++ twisted-24.10.0/src/twisted/web/http.py
|
||||
@@ -125,6 +125,7 @@ from urllib.parse import (
|
||||
ParseResultBytes,
|
||||
unquote_to_bytes as unquote,
|
||||
urlparse as _urlparse,
|
||||
+ parse_qs,
|
||||
)
|
||||
|
||||
from zope.interface import Attribute, Interface, implementer, provider
|
||||
@@ -371,34 +372,6 @@ def urlparse(url):
|
||||
return ParseResultBytes(scheme, netloc, path, params, query, fragment)
|
||||
|
||||
|
||||
-def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
|
||||
- """
|
||||
- Like C{cgi.parse_qs}, but with support for parsing byte strings on Python 3.
|
||||
-
|
||||
- This was created to help with Python 2 to Python 3 migration.
|
||||
- Consider using L{urllib.parse.parse_qs}.
|
||||
-
|
||||
- @type qs: C{bytes}
|
||||
- """
|
||||
- d = {}
|
||||
- items = [s2 for s1 in qs.split(b"&") for s2 in s1.split(b";")]
|
||||
- for item in items:
|
||||
- try:
|
||||
- k, v = item.split(b"=", 1)
|
||||
- except ValueError:
|
||||
- if strict_parsing:
|
||||
- raise
|
||||
- continue
|
||||
- if v or keep_blank_values:
|
||||
- k = unquote(k.replace(b"+", b" "))
|
||||
- v = unquote(v.replace(b"+", b" "))
|
||||
- if k in d:
|
||||
- d[k].append(v)
|
||||
- else:
|
||||
- d[k] = [v]
|
||||
- return d
|
||||
-
|
||||
-
|
||||
def datetimeToString(msSinceEpoch=None):
|
||||
"""
|
||||
Convert seconds since epoch to HTTP datetime string.
|
||||
Index: twisted-24.10.0/src/twisted/web/newsfragments/10096.bugfix
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ twisted-24.10.0/src/twisted/web/newsfragments/10096.bugfix
|
||||
@@ -0,0 +1 @@
|
||||
+delegate to urllib.parse:parse_qs in twisted.web.http:parse_qs to avoid CVE-2021-23336 and the associated CI failures
|
||||
242
CVE-2024-41671.patch
Normal file
242
CVE-2024-41671.patch
Normal file
@@ -0,0 +1,242 @@
|
||||
Index: twisted-24.3.0/src/twisted/web/http.py
|
||||
===================================================================
|
||||
--- twisted-24.3.0.orig/src/twisted/web/http.py
|
||||
+++ twisted-24.3.0/src/twisted/web/http.py
|
||||
@@ -1973,16 +1973,21 @@ class _ChunkedTransferDecoder:
|
||||
@returns: C{False}, as there is either insufficient data to continue,
|
||||
or no data remains.
|
||||
"""
|
||||
- if (
|
||||
- self._receivedTrailerHeadersSize + len(self._buffer)
|
||||
- > self._maxTrailerHeadersSize
|
||||
- ):
|
||||
- raise _MalformedChunkedDataError("Trailer headers data is too long.")
|
||||
-
|
||||
eolIndex = self._buffer.find(b"\r\n", self._start)
|
||||
|
||||
if eolIndex == -1:
|
||||
# Still no end of network line marker found.
|
||||
+ #
|
||||
+ # Check if we've run up against the trailer size limit: if the next
|
||||
+ # read contains the terminating CRLF then we'll have this many bytes
|
||||
+ # of trailers (including the CRLFs).
|
||||
+ minTrailerSize = (
|
||||
+ self._receivedTrailerHeadersSize
|
||||
+ + len(self._buffer)
|
||||
+ + (1 if self._buffer.endswith(b"\r") else 2)
|
||||
+ )
|
||||
+ if minTrailerSize > self._maxTrailerHeadersSize:
|
||||
+ raise _MalformedChunkedDataError("Trailer headers data is too long.")
|
||||
# Continue processing more data.
|
||||
return False
|
||||
|
||||
@@ -1992,6 +1997,8 @@ class _ChunkedTransferDecoder:
|
||||
del self._buffer[0 : eolIndex + 2]
|
||||
self._start = 0
|
||||
self._receivedTrailerHeadersSize += eolIndex + 2
|
||||
+ if self._receivedTrailerHeadersSize > self._maxTrailerHeadersSize:
|
||||
+ raise _MalformedChunkedDataError("Trailer headers data is too long.")
|
||||
return True
|
||||
|
||||
# eolIndex in this part of code is equal to 0
|
||||
@@ -2315,8 +2322,8 @@ class HTTPChannel(basic.LineReceiver, po
|
||||
self.__header = line
|
||||
|
||||
def _finishRequestBody(self, data):
|
||||
- self.allContentReceived()
|
||||
self._dataBuffer.append(data)
|
||||
+ self.allContentReceived()
|
||||
|
||||
def _maybeChooseTransferDecoder(self, header, data):
|
||||
"""
|
||||
Index: twisted-24.3.0/src/twisted/web/newsfragments/12248.bugfix
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ twisted-24.3.0/src/twisted/web/newsfragments/12248.bugfix
|
||||
@@ -0,0 +1 @@
|
||||
+The HTTP 1.0 and 1.1 server provided by twisted.web could process pipelined HTTP requests out-of-order, possibly resulting in information disclosure (CVE-2024-41671/GHSA-c8m8-j448-xjx7)
|
||||
Index: twisted-24.3.0/src/twisted/web/test/test_http.py
|
||||
===================================================================
|
||||
--- twisted-24.3.0.orig/src/twisted/web/test/test_http.py
|
||||
+++ twisted-24.3.0/src/twisted/web/test/test_http.py
|
||||
@@ -135,7 +135,7 @@ class DummyHTTPHandler(http.Request):
|
||||
data = self.content.read()
|
||||
length = self.getHeader(b"content-length")
|
||||
if length is None:
|
||||
- length = networkString(str(length))
|
||||
+ length = str(length).encode()
|
||||
request = b"'''\n" + length + b"\n" + data + b"'''\n"
|
||||
self.setResponseCode(200)
|
||||
self.setHeader(b"Request", self.uri)
|
||||
@@ -563,17 +563,23 @@ class HTTP0_9Tests(HTTP1_0Tests):
|
||||
|
||||
class PipeliningBodyTests(unittest.TestCase, ResponseTestMixin):
|
||||
"""
|
||||
- Tests that multiple pipelined requests with bodies are correctly buffered.
|
||||
+ Pipelined requests get buffered and executed in the order received,
|
||||
+ not processed in parallel.
|
||||
"""
|
||||
|
||||
requests = (
|
||||
b"POST / HTTP/1.1\r\n"
|
||||
b"Content-Length: 10\r\n"
|
||||
b"\r\n"
|
||||
- b"0123456789POST / HTTP/1.1\r\n"
|
||||
- b"Content-Length: 10\r\n"
|
||||
- b"\r\n"
|
||||
b"0123456789"
|
||||
+ # Chunk encoded request.
|
||||
+ b"POST / HTTP/1.1\r\n"
|
||||
+ b"Transfer-Encoding: chunked\r\n"
|
||||
+ b"\r\n"
|
||||
+ b"a\r\n"
|
||||
+ b"0123456789\r\n"
|
||||
+ b"0\r\n"
|
||||
+ b"\r\n"
|
||||
)
|
||||
|
||||
expectedResponses = [
|
||||
@@ -590,14 +596,16 @@ class PipeliningBodyTests(unittest.TestC
|
||||
b"Request: /",
|
||||
b"Command: POST",
|
||||
b"Version: HTTP/1.1",
|
||||
- b"Content-Length: 21",
|
||||
- b"'''\n10\n0123456789'''\n",
|
||||
+ b"Content-Length: 23",
|
||||
+ b"'''\nNone\n0123456789'''\n",
|
||||
),
|
||||
]
|
||||
|
||||
- def test_noPipelining(self):
|
||||
+ def test_stepwiseTinyTube(self):
|
||||
"""
|
||||
- Test that pipelined requests get buffered, not processed in parallel.
|
||||
+ Imitate a slow connection that delivers one byte at a time.
|
||||
+ The request handler (L{DelayedHTTPHandler}) is puppeted to
|
||||
+ step through the handling of each request.
|
||||
"""
|
||||
b = StringTransport()
|
||||
a = http.HTTPChannel()
|
||||
@@ -606,10 +614,9 @@ class PipeliningBodyTests(unittest.TestC
|
||||
# one byte at a time, to stress it.
|
||||
for byte in iterbytes(self.requests):
|
||||
a.dataReceived(byte)
|
||||
- value = b.value()
|
||||
|
||||
# So far only one request should have been dispatched.
|
||||
- self.assertEqual(value, b"")
|
||||
+ self.assertEqual(b.value(), b"")
|
||||
self.assertEqual(1, len(a.requests))
|
||||
|
||||
# Now, process each request one at a time.
|
||||
@@ -618,8 +625,95 @@ class PipeliningBodyTests(unittest.TestC
|
||||
request = a.requests[0].original
|
||||
request.delayedProcess()
|
||||
|
||||
- value = b.value()
|
||||
- self.assertResponseEquals(value, self.expectedResponses)
|
||||
+ self.assertResponseEquals(b.value(), self.expectedResponses)
|
||||
+
|
||||
+ def test_stepwiseDumpTruck(self):
|
||||
+ """
|
||||
+ Imitate a fast connection where several pipelined
|
||||
+ requests arrive in a single read. The request handler
|
||||
+ (L{DelayedHTTPHandler}) is puppeted to step through the
|
||||
+ handling of each request.
|
||||
+ """
|
||||
+ b = StringTransport()
|
||||
+ a = http.HTTPChannel()
|
||||
+ a.requestFactory = DelayedHTTPHandlerProxy
|
||||
+ a.makeConnection(b)
|
||||
+
|
||||
+ a.dataReceived(self.requests)
|
||||
+
|
||||
+ # So far only one request should have been dispatched.
|
||||
+ self.assertEqual(b.value(), b"")
|
||||
+ self.assertEqual(1, len(a.requests))
|
||||
+
|
||||
+ # Now, process each request one at a time.
|
||||
+ while a.requests:
|
||||
+ self.assertEqual(1, len(a.requests))
|
||||
+ request = a.requests[0].original
|
||||
+ request.delayedProcess()
|
||||
+
|
||||
+ self.assertResponseEquals(b.value(), self.expectedResponses)
|
||||
+
|
||||
+ def test_immediateTinyTube(self):
|
||||
+ """
|
||||
+ Imitate a slow connection that delivers one byte at a time.
|
||||
+
|
||||
+ (L{DummyHTTPHandler}) immediately responds, but no more
|
||||
+ than one
|
||||
+ """
|
||||
+ b = StringTransport()
|
||||
+ a = http.HTTPChannel()
|
||||
+ a.requestFactory = DummyHTTPHandlerProxy # "sync"
|
||||
+ a.makeConnection(b)
|
||||
+
|
||||
+ # one byte at a time, to stress it.
|
||||
+ for byte in iterbytes(self.requests):
|
||||
+ a.dataReceived(byte)
|
||||
+ # There is never more than one request dispatched at a time:
|
||||
+ self.assertLessEqual(len(a.requests), 1)
|
||||
+
|
||||
+ self.assertResponseEquals(b.value(), self.expectedResponses)
|
||||
+
|
||||
+ def test_immediateDumpTruck(self):
|
||||
+ """
|
||||
+ Imitate a fast connection where several pipelined
|
||||
+ requests arrive in a single read. The request handler
|
||||
+ (L{DummyHTTPHandler}) immediately responds.
|
||||
+
|
||||
+ This doesn't check the at-most-one pending request
|
||||
+ invariant but exercises otherwise uncovered code paths.
|
||||
+ See GHSA-c8m8-j448-xjx7.
|
||||
+ """
|
||||
+ b = StringTransport()
|
||||
+ a = http.HTTPChannel()
|
||||
+ a.requestFactory = DummyHTTPHandlerProxy
|
||||
+ a.makeConnection(b)
|
||||
+
|
||||
+ # All bytes at once to ensure there's stuff to buffer.
|
||||
+ a.dataReceived(self.requests)
|
||||
+
|
||||
+ self.assertResponseEquals(b.value(), self.expectedResponses)
|
||||
+
|
||||
+ def test_immediateABiggerTruck(self):
|
||||
+ """
|
||||
+ Imitate a fast connection where a so many pipelined
|
||||
+ requests arrive in a single read that backpressure is indicated.
|
||||
+ The request handler (L{DummyHTTPHandler}) immediately responds.
|
||||
+
|
||||
+ This doesn't check the at-most-one pending request
|
||||
+ invariant but exercises otherwise uncovered code paths.
|
||||
+ See GHSA-c8m8-j448-xjx7.
|
||||
+
|
||||
+ @see: L{http.HTTPChannel._optimisticEagerReadSize}
|
||||
+ """
|
||||
+ b = StringTransport()
|
||||
+ a = http.HTTPChannel()
|
||||
+ a.requestFactory = DummyHTTPHandlerProxy
|
||||
+ a.makeConnection(b)
|
||||
+
|
||||
+ overLimitCount = a._optimisticEagerReadSize // len(self.requests) * 10
|
||||
+ a.dataReceived(self.requests * overLimitCount)
|
||||
+
|
||||
+ self.assertResponseEquals(b.value(), self.expectedResponses * overLimitCount)
|
||||
|
||||
def test_pipeliningReadLimit(self):
|
||||
"""
|
||||
@@ -1522,7 +1616,11 @@ class ChunkedTransferEncodingTests(unitt
|
||||
lambda b: None, # pragma: nocov
|
||||
)
|
||||
p._maxTrailerHeadersSize = 10
|
||||
- p.dataReceived(b"3\r\nabc\r\n0\r\n0123456789")
|
||||
+ # 9 bytes are received so far, in 2 packets.
|
||||
+ # For now, all is ok.
|
||||
+ p.dataReceived(b"3\r\nabc\r\n0\r\n01234567")
|
||||
+ p.dataReceived(b"\r")
|
||||
+ # Once the 10th byte is received, the processing fails.
|
||||
self.assertRaises(
|
||||
http._MalformedChunkedDataError,
|
||||
p.dataReceived,
|
||||
83
CVE-2024-41810.patch
Normal file
83
CVE-2024-41810.patch
Normal file
@@ -0,0 +1,83 @@
|
||||
Index: twisted-24.3.0/src/twisted/web/_template_util.py
|
||||
===================================================================
|
||||
--- twisted-24.3.0.orig/src/twisted/web/_template_util.py
|
||||
+++ twisted-24.3.0/src/twisted/web/_template_util.py
|
||||
@@ -92,7 +92,7 @@ def redirectTo(URL: bytes, request: IReq
|
||||
</body>
|
||||
</html>
|
||||
""" % {
|
||||
- b"url": URL
|
||||
+ b"url": escape(URL.decode("utf-8")).encode("utf-8")
|
||||
}
|
||||
return content
|
||||
|
||||
Index: twisted-24.3.0/src/twisted/web/newsfragments/12263.bugfix
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ twisted-24.3.0/src/twisted/web/newsfragments/12263.bugfix
|
||||
@@ -0,0 +1 @@
|
||||
+twisted.web.util.redirectTo now HTML-escapes the provided URL in the fallback response body it returns (GHSA-cf56-g6w6-pqq2). The issue is being tracked with CVE-2024-41810.
|
||||
\ No newline at end of file
|
||||
Index: twisted-24.3.0/src/twisted/web/newsfragments/9839.bugfix
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ twisted-24.3.0/src/twisted/web/newsfragments/9839.bugfix
|
||||
@@ -0,0 +1 @@
|
||||
+twisted.web.util.redirectTo now HTML-escapes the provided URL in the fallback response body it returns (GHSA-cf56-g6w6-pqq2, CVE-2024-41810).
|
||||
Index: twisted-24.3.0/src/twisted/web/test/test_util.py
|
||||
===================================================================
|
||||
--- twisted-24.3.0.orig/src/twisted/web/test/test_util.py
|
||||
+++ twisted-24.3.0/src/twisted/web/test/test_util.py
|
||||
@@ -5,7 +5,6 @@
|
||||
Tests for L{twisted.web.util}.
|
||||
"""
|
||||
|
||||
-
|
||||
import gc
|
||||
|
||||
from twisted.internet import defer
|
||||
@@ -64,6 +63,44 @@ class RedirectToTests(TestCase):
|
||||
targetURL = "http://target.example.com/4321"
|
||||
self.assertRaises(TypeError, redirectTo, targetURL, request)
|
||||
|
||||
+ def test_legitimateRedirect(self):
|
||||
+ """
|
||||
+ Legitimate URLs are fully interpolated in the `redirectTo` response body without transformation
|
||||
+ """
|
||||
+ request = DummyRequest([b""])
|
||||
+ html = redirectTo(b"https://twisted.org/", request)
|
||||
+ expected = b"""
|
||||
+<html>
|
||||
+ <head>
|
||||
+ <meta http-equiv=\"refresh\" content=\"0;URL=https://twisted.org/\">
|
||||
+ </head>
|
||||
+ <body bgcolor=\"#FFFFFF\" text=\"#000000\">
|
||||
+ <a href=\"https://twisted.org/\">click here</a>
|
||||
+ </body>
|
||||
+</html>
|
||||
+"""
|
||||
+ self.assertEqual(html, expected)
|
||||
+
|
||||
+ def test_maliciousRedirect(self):
|
||||
+ """
|
||||
+ Malicious URLs are HTML-escaped before interpolating them in the `redirectTo` response body
|
||||
+ """
|
||||
+ request = DummyRequest([b""])
|
||||
+ html = redirectTo(
|
||||
+ b'https://twisted.org/"><script>alert(document.location)</script>', request
|
||||
+ )
|
||||
+ expected = b"""
|
||||
+<html>
|
||||
+ <head>
|
||||
+ <meta http-equiv=\"refresh\" content=\"0;URL=https://twisted.org/"><script>alert(document.location)</script>\">
|
||||
+ </head>
|
||||
+ <body bgcolor=\"#FFFFFF\" text=\"#000000\">
|
||||
+ <a href=\"https://twisted.org/"><script>alert(document.location)</script>\">click here</a>
|
||||
+ </body>
|
||||
+</html>
|
||||
+"""
|
||||
+ self.assertEqual(html, expected)
|
||||
+
|
||||
|
||||
class ParentRedirectTests(SynchronousTestCase):
|
||||
"""
|
||||
3
_multibuild
Normal file
3
_multibuild
Normal file
@@ -0,0 +1,3 @@
|
||||
<multibuild>
|
||||
<package>test</package>
|
||||
</multibuild>
|
||||
14
no-cython_test_exception_raiser.patch
Normal file
14
no-cython_test_exception_raiser.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff --git a/src/twisted/test/test_failure.py b/src/twisted/test/test_failure.py
|
||||
index a9e920c10e..de9c499972 100644
|
||||
--- a/src/twisted/test/test_failure.py
|
||||
+++ b/src/twisted/test/test_failure.py
|
||||
@@ -19,7 +19,8 @@ from types import TracebackType
|
||||
from typing import Any, Generator, cast
|
||||
from unittest import skipIf
|
||||
|
||||
-from cython_test_exception_raiser import raiser
|
||||
+# from cython_test_exception_raiser import raiser
|
||||
+raiser = None
|
||||
|
||||
from twisted.python import failure, reflect
|
||||
from twisted.trial.unittest import SynchronousTestCase
|
||||
25
no-test_successResultOfWithFailureHasTraceback.patch
Normal file
25
no-test_successResultOfWithFailureHasTraceback.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
src/twisted/conch/test/test_keys.py | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
Index: twisted-24.10.0/src/twisted/conch/test/test_keys.py
|
||||
===================================================================
|
||||
--- twisted-24.10.0.orig/src/twisted/conch/test/test_keys.py
|
||||
+++ twisted-24.10.0/src/twisted/conch/test/test_keys.py
|
||||
@@ -15,6 +15,7 @@ from twisted.python import randbytes
|
||||
from twisted.python.filepath import FilePath
|
||||
from twisted.python.reflect import requireModule
|
||||
from twisted.trial import unittest
|
||||
+import unittest as pyunit
|
||||
|
||||
cryptography = requireModule("cryptography")
|
||||
if cryptography is None:
|
||||
@@ -278,6 +279,8 @@ class KeyTests(unittest.TestCase):
|
||||
publicKey = keys.Key.fromString(public)
|
||||
self.assertTrue(publicKey._sk)
|
||||
|
||||
+ @pyunit.skip('Upstream ticket https://twistedmatrix.com/trac/ticket/9665' +
|
||||
+ ' has still not been resolved.')
|
||||
def test_fromOpenSSH(self):
|
||||
"""
|
||||
Test that keys are correctly generated from OpenSSH strings.
|
||||
1702
python-Twisted.changes
Normal file
1702
python-Twisted.changes
Normal file
File diff suppressed because it is too large
Load Diff
2
python-Twisted.rpmlintrc
Normal file
2
python-Twisted.rpmlintrc
Normal file
@@ -0,0 +1,2 @@
|
||||
# rpmlint is too stupid for the . in the name
|
||||
addFilter("python-.*-require .*zope.interface")
|
||||
325
python-Twisted.spec
Normal file
325
python-Twisted.spec
Normal file
@@ -0,0 +1,325 @@
|
||||
#
|
||||
# spec file for package python-Twisted
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%global flavor @BUILD_FLAVOR@%{nil}
|
||||
%if "%{flavor}" == "test"
|
||||
%define psuffix -test
|
||||
%bcond_without test
|
||||
%else
|
||||
%define psuffix %{nil}
|
||||
%bcond_with test
|
||||
%endif
|
||||
%if 0%{?suse_version} > 1500
|
||||
%bcond_without libalternatives
|
||||
%else
|
||||
%bcond_with libalternatives
|
||||
%endif
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-Twisted%{psuffix}
|
||||
Version: 24.10.0
|
||||
Release: 0
|
||||
Summary: An asynchronous networking framework written in Python
|
||||
License: MIT
|
||||
URL: https://twisted.org
|
||||
Source0: https://files.pythonhosted.org/packages/source/t/twisted/twisted-%{version}.tar.gz
|
||||
Source99: python-Twisted.rpmlintrc
|
||||
Patch0: skip_MultiCast.patch
|
||||
# PATCH-FIX-UPSTREAM no-test_successResultOfWithFailureHasTraceback.patch https://twistedmatrix.com/trac/ticket/9665 mcepl@suse.com
|
||||
# skip over the test test_successResultOfWithFailureHasTraceback
|
||||
Patch2: no-test_successResultOfWithFailureHasTraceback.patch
|
||||
# PATCH-FIX-UPSTREAM 1521_delegate_parseqs_stdlib_bpo42967.patch https://twistedmatrix.com/trac/ticket/10096 mcepl@suse.com
|
||||
# overcome incompatibility with the solution for bpo#42967.
|
||||
Patch3: 1521_delegate_parseqs_stdlib_bpo42967.patch
|
||||
# PATCH-FIX-OPENSUSE We don't want to package yet another module, and it is easily skippable
|
||||
Patch5: no-cython_test_exception_raiser.patch
|
||||
# PATCH-FIX-OPENSUSE remove-dependency-version-upper-bounds.patch boo#1190036 -- run with h2 >= 4.0.0 and priority >= 2.0
|
||||
Patch6: remove-dependency-version-upper-bounds.patch
|
||||
BuildRequires: %{python_module hatch-fancy-pypi-readme}
|
||||
BuildRequires: %{python_module hatchling}
|
||||
BuildRequires: %{python_module incremental >= 24.7.0}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: git-core
|
||||
BuildRequires: python-rpm-macros
|
||||
# twisted[tls] is so common, let's keep it tied to the main package for the time being.
|
||||
Requires: python-Twisted-tls = %{version}
|
||||
BuildArch: noarch
|
||||
# SECTION install requires
|
||||
Requires: python-Automat >= 0.8.0
|
||||
Requires: python-attrs >= 19.2.0
|
||||
Requires: python-constantly >= 15.1
|
||||
Requires: python-hyperlink >= 17.1.1
|
||||
Requires: python-incremental >= 24.7.0
|
||||
Requires: python-typing_extensions >= 3.6.5
|
||||
Requires: python-zope.interface >= 4.4.2
|
||||
# /SECTION
|
||||
%if %{with libalternatives}
|
||||
BuildRequires: alts
|
||||
Requires: alts
|
||||
%else
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
%endif
|
||||
%if %{with test}
|
||||
BuildRequires: %{python_module Twisted-all_non_platform = %{version}}
|
||||
BuildRequires: %{python_module Twisted-conch_nacl = %{version}}
|
||||
BuildRequires: %{python_module httpx}
|
||||
BuildRequires: %{python_module hypothesis}
|
||||
# declared nowhere but required to pass 8 tests with timezone checks
|
||||
BuildRequires: %{python_module pytz}
|
||||
%endif
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
An extensible framework for Python programming, with special focus
|
||||
on event-based network programming and multiprotocol integration.
|
||||
|
||||
%if 0%{?suse_version} > 1500
|
||||
%package -n %{name}-doc
|
||||
Summary: An asynchronous networking framework written in Python - Documentation
|
||||
|
||||
%description -n %{name}-doc
|
||||
An extensible framework for Python programming, with special focus
|
||||
on event-based network programming and multiprotocol integration.
|
||||
|
||||
This package contains the documentation for python-Twisted
|
||||
%endif
|
||||
|
||||
%package tls
|
||||
Summary: TLS support for Twisted
|
||||
Requires: python-Twisted = %{version}
|
||||
Requires: python-idna >= 2.4
|
||||
Requires: python-pyOpenSSL >= 16.0.0
|
||||
Requires: python-service_identity >= 18.1.0
|
||||
|
||||
%description tls
|
||||
Twisted is an extensible framework for Python programming, with special focus
|
||||
on event-based network programming and multiprotocol integration.
|
||||
|
||||
This metapackage is for the optional feature tls
|
||||
|
||||
%package conch
|
||||
Summary: Conch for Twisted
|
||||
Requires: python-Twisted = %{version}
|
||||
Requires: python-appdirs >= 1.4.0
|
||||
Requires: python-bcrypt >= 3.0.0
|
||||
Requires: python-cryptography >= 2.6
|
||||
|
||||
%description conch
|
||||
Twisted is an extensible framework for Python programming, with special focus
|
||||
on event-based network programming and multiprotocol integration.
|
||||
|
||||
Twisted Conch: The Twisted Shell. Terminal emulation, SSHv2 and telnet.
|
||||
|
||||
%package conch_nacl
|
||||
Summary: Conch w/ NaCl for Twisted
|
||||
Requires: python-Twisted-conch = %{version}
|
||||
|
||||
%description conch_nacl
|
||||
Twisted is an extensible framework for Python programming, with special focus
|
||||
on event-based network programming and multiprotocol integration.
|
||||
|
||||
%package serial
|
||||
Summary: Serial support for Twisted
|
||||
Requires: python-Twisted = %{version}
|
||||
Requires: python-pyserial >= 3.0
|
||||
|
||||
%description serial
|
||||
Twisted is an extensible framework for Python programming, with special focus
|
||||
on event-based network programming and multiprotocol integration.
|
||||
|
||||
This metapackage is for the optional feature serial
|
||||
|
||||
%package http2
|
||||
Summary: HTTP/2 support for Twisted
|
||||
Requires: python-Twisted = %{version}
|
||||
Requires: python-h2 >= 3.0
|
||||
Requires: python-priority >= 1.1.0
|
||||
|
||||
%description http2
|
||||
Twisted is an extensible framework for Python programming, with special focus
|
||||
on event-based network programming and multiprotocol integration.
|
||||
|
||||
This metapackage is for the optional feature http2
|
||||
|
||||
%package contextvars
|
||||
Summary: Contextvars extra for Twisted
|
||||
Requires: python-Twisted = %{version}
|
||||
|
||||
%description contextvars
|
||||
Twisted is an extensible framework for Python programming, with special focus
|
||||
on event-based network programming and multiprotocol integration.
|
||||
|
||||
This metapackage is for the optional dependency contextvars
|
||||
|
||||
%package all_non_platform
|
||||
Summary: The all_non_platform dependency extra for Twisted
|
||||
Requires: python-PyHamcrest >= 1.9.0
|
||||
Requires: python-Twisted-conch = %{version}
|
||||
Requires: python-Twisted-contextvars = %{version}
|
||||
Requires: python-Twisted-http2 = %{version}
|
||||
Requires: python-Twisted-serial = %{version}
|
||||
Requires: python-Twisted-tls = %{version}
|
||||
|
||||
%description all_non_platform
|
||||
Twisted is an extensible framework for Python programming, with special focus
|
||||
on event-based network programming and multiprotocol integration.
|
||||
|
||||
This metapackage is for the optional dependency all_non_platform
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n twisted-%{version}
|
||||
sed -i '1{/env python/d}' src/twisted/mail/test/pop3testserver.py src/twisted/trial/test/scripttest.py
|
||||
find src/twisted -name .gitignore -delete
|
||||
find src/twisted -name '*.misc' -size 0 -delete
|
||||
|
||||
%if ! %{with test}
|
||||
%build
|
||||
%pyproject_wheel
|
||||
|
||||
# empty files
|
||||
rm docs/{fun/Twisted.Quotes,_static/.placeholder,_templates/.placeholder}
|
||||
%fdupes docs
|
||||
%endif
|
||||
|
||||
%if ! %{with test}
|
||||
%install
|
||||
%pyproject_install
|
||||
find %{buildroot} -regex '.*\.[ch]' -exec rm {} ";" # Remove leftover C sources
|
||||
install -dm0755 %{buildroot}%{_mandir}/man1/
|
||||
install -m0644 docs/*/man/*.1 %{buildroot}%{_mandir}/man1/ # Install man pages
|
||||
find docs -type f -print0 | xargs -0 chmod a-x # Fix doc-file dependency by removing x flags
|
||||
#sed -i "s/\r//" docs/core/howto/listings/udp/{MulticastClient,MulticastServer}.py
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
%if 0%{?suse_version} > 1500
|
||||
mkdir -p %{buildroot}%{_docdir}/%{name}-doc
|
||||
cp -r docs/* %{buildroot}%{_docdir}/%{name}-doc
|
||||
%fdupes %{buildroot}%{_docdir}/%{name}-doc
|
||||
%endif
|
||||
|
||||
# Prepare for update-alternatives usage
|
||||
for p in twistd cftp ckeygen conch pyhtmlizer tkconch trial ; do
|
||||
%python_clone -a %{buildroot}%{_bindir}/$p
|
||||
%python_clone -a %{buildroot}%{_mandir}/man1/$p.1
|
||||
done
|
||||
|
||||
# mailmail is useful only on Python 2
|
||||
rm %{buildroot}%{_bindir}/mailmail %{buildroot}%{_mandir}/man1/mailmail.1
|
||||
|
||||
# no manpage for twist yet:
|
||||
%python_clone -a %{buildroot}%{_bindir}/twist
|
||||
# group all the alternatives under one master
|
||||
%python_group_libalternatives twistd cftp ckeygen conch pyhtmlizer tkconch trial twist
|
||||
%endif
|
||||
|
||||
%if %{with test}
|
||||
%check
|
||||
export LANG=en_US.UTF-8
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
%{python_expand # provide flavored commands for testing
|
||||
# (= python_flavored_alternatives from gh#openSUSE/python-rpm-macros#120, but sadly not available for non-TW)
|
||||
mkdir -p build/bin/
|
||||
for f in %{buildroot}%{_bindir}/*-%{$python_bin_suffix}; do
|
||||
ln -s $f build/bin/$(basename ${f%%%%-%{$python_bin_suffix}})
|
||||
done
|
||||
}
|
||||
export PATH=$PWD/build/bin/:$PATH
|
||||
|
||||
# Relax the crypto policies for the test-suite
|
||||
export OPENSSL_SYSTEM_CIPHERS_OVERRIDE=xyz_nonexistent_file
|
||||
export OPENSSL_CONF=''
|
||||
|
||||
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m twisted.trial twisted
|
||||
%endif
|
||||
|
||||
%pre
|
||||
%python_libalternatives_reset_alternative twistd
|
||||
# these were master alternatives until Dec 2020
|
||||
for f in cftp ckeygen conch pyhtmlizer tkconch trial twist; do
|
||||
%python_libalternatives_reset_alternative $f
|
||||
done
|
||||
|
||||
%post
|
||||
%if !%{with libalternatives}
|
||||
# these were master alternatives until Dec 2020. Remove before the install as slave links
|
||||
for f in cftp ckeygen conch pyhtmlizer tkconch trial twist; do
|
||||
(update-alternatives --quiet --list $f 2>&1 >/dev/null) && update-alternatives --quiet --remove-all $f
|
||||
done
|
||||
%endif
|
||||
%{python_install_alternative twistd cftp ckeygen conch pyhtmlizer tkconch trial twist
|
||||
twistd.1 cftp.1 ckeygen.1 conch.1 pyhtmlizer.1 tkconch.1 trial.1}
|
||||
|
||||
%postun
|
||||
%python_uninstall_alternative twistd
|
||||
|
||||
%if ! %{with test}
|
||||
%files %{python_files tls}
|
||||
%license LICENSE
|
||||
|
||||
%files %{python_files conch}
|
||||
%license LICENSE
|
||||
|
||||
%files %{python_files conch_nacl}
|
||||
%license LICENSE
|
||||
|
||||
%files %{python_files serial}
|
||||
%license LICENSE
|
||||
|
||||
%files %{python_files http2}
|
||||
%license LICENSE
|
||||
|
||||
%files %{python_files contextvars}
|
||||
%license LICENSE
|
||||
|
||||
%files %{python_files all_non_platform}
|
||||
%license LICENSE
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%doc NEWS.rst README.rst
|
||||
%python_alternative %{_bindir}/conch
|
||||
%python_alternative %{_bindir}/tkconch
|
||||
%python_alternative %{_mandir}/man1/conch.1%{?ext_man}
|
||||
%python_alternative %{_mandir}/man1/tkconch.1%{?ext_man}
|
||||
%python_alternative %{_bindir}/twistd
|
||||
%python_alternative %{_bindir}/cftp
|
||||
%python_alternative %{_bindir}/ckeygen
|
||||
%python_alternative %{_bindir}/pyhtmlizer
|
||||
%python_alternative %{_bindir}/trial
|
||||
%python_alternative %{_bindir}/twist
|
||||
%python_alternative %{_mandir}/man1/twistd.1%{?ext_man}
|
||||
%python_alternative %{_mandir}/man1/cftp.1%{?ext_man}
|
||||
%python_alternative %{_mandir}/man1/ckeygen.1%{?ext_man}
|
||||
%python_alternative %{_mandir}/man1/pyhtmlizer.1%{?ext_man}
|
||||
%python_alternative %{_mandir}/man1/trial.1%{?ext_man}
|
||||
%{python_sitelib}/twisted
|
||||
%{python_sitelib}/twisted-%{version}*-info
|
||||
|
||||
%if 0%{?suse_version} > 1500
|
||||
%files -n %{name}-doc
|
||||
%doc %{_docdir}/%{name}-doc
|
||||
%else
|
||||
%doc docs/
|
||||
%endif
|
||||
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
15
remove-dependency-version-upper-bounds.patch
Normal file
15
remove-dependency-version-upper-bounds.patch
Normal file
@@ -0,0 +1,15 @@
|
||||
Index: twisted-24.10.0/pyproject.toml
|
||||
===================================================================
|
||||
--- twisted-24.10.0.orig/pyproject.toml
|
||||
+++ twisted-24.10.0/pyproject.toml
|
||||
@@ -97,8 +97,8 @@ serial = [
|
||||
]
|
||||
|
||||
http2 = [
|
||||
- "h2 >= 3.2, < 5.0",
|
||||
- "priority >= 1.1.0, < 2.0",
|
||||
+ "h2 >= 3.2",
|
||||
+ "priority >= 1.1.0",
|
||||
]
|
||||
|
||||
all-non-platform = [
|
||||
25
skip_MultiCast.patch
Normal file
25
skip_MultiCast.patch
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
src/twisted/test/test_udp.py | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: twisted-24.3.0/src/twisted/test/test_udp.py
|
||||
===================================================================
|
||||
--- twisted-24.3.0.orig/src/twisted/test/test_udp.py
|
||||
+++ twisted-24.3.0/src/twisted/test/test_udp.py
|
||||
@@ -8,7 +8,7 @@ Tests for implementations of L{IReactorU
|
||||
|
||||
|
||||
import os
|
||||
-from unittest import skipIf
|
||||
+from unittest import skipIf, SkipTest
|
||||
|
||||
from twisted.internet import defer, error, interfaces, protocol, reactor, udp
|
||||
from twisted.internet.defer import Deferred, gatherResults, maybeDeferred
|
||||
@@ -578,6 +578,7 @@ class MulticastTests(TestCase):
|
||||
skip = "This reactor does not support multicast"
|
||||
|
||||
def setUp(self):
|
||||
+ raise SkipTest("Multicast networking doesn't work with OBS")
|
||||
self.server = Server()
|
||||
self.client = Client()
|
||||
# multicast won't work if we listen over loopback, apparently
|
||||
BIN
twisted-24.10.0.tar.gz
LFS
Normal file
BIN
twisted-24.10.0.tar.gz
LFS
Normal file
Binary file not shown.
BIN
twisted-24.3.0.tar.gz
LFS
Normal file
BIN
twisted-24.3.0.tar.gz
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user