public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/twisted/files/, dev-python/twisted/
Date: Sun, 28 May 2023 23:32:02 +0000 (UTC)	[thread overview]
Message-ID: <1685316712.d2c8622b7c5df457f8ab238774f3e1c3624aecd1.sam@gentoo> (raw)

commit:     d2c8622b7c5df457f8ab238774f3e1c3624aecd1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun May 28 23:27:48 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May 28 23:31:52 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2c8622b

dev-python/twisted: backport some 3.11 fixes

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/twisted-22.10.0-python3.11-tests.patch   | 100 ++++++++++++++++++
 .../twisted/files/twisted-22.10.0-sendmail.patch   |  28 +++++
 .../twisted/files/twisted-22.10.0-time.patch       | 113 +++++++++++++++++++++
 ...22.10.0-r2.ebuild => twisted-22.10.0-r3.ebuild} |   4 +
 4 files changed, 245 insertions(+)

diff --git a/dev-python/twisted/files/twisted-22.10.0-python3.11-tests.patch b/dev-python/twisted/files/twisted-22.10.0-python3.11-tests.patch
new file mode 100644
index 000000000000..b75c97d4997f
--- /dev/null
+++ b/dev-python/twisted/files/twisted-22.10.0-python3.11-tests.patch
@@ -0,0 +1,100 @@
+https://src.fedoraproject.org/rpms/python-twisted/blob/rawhide/f/0003-Fix-tests-for-Python-3.11.patch
+
+From b0574816f622bc187389df2183e2bef0492fe5f5 Mon Sep 17 00:00:00 2001
+From: eevel <eevel@weezel3.weezelnet>
+Date: Wed, 2 Nov 2022 20:35:55 -0500
+Subject: [PATCH 3/6] Fix tests for Python 3.11
+
+This is based on a subset of commits from this pull request.
+
+https://github.com/twisted/twisted/pull/11734
+
+- fix twisted.persisted tests (cherry picked from commit 4f6d7fb0749429b092fe7538a7d2b11fe58319a6)
+- fix tests for twisted.spread (cherry picked from commit 525377178adfa987ed56be753aec0fce35d721dc)
+- fix test for twisted.web (cherry picked from commit afcc224a02f72e5d12fa35d223bd753e8086b135)
+- fix persisted tests in twisted.test (cherry picked from commit 4b5ab38b09b326cec7967e04bd4cae8a84bb6784)
+- fix twisted.trial tests (cherry picked from commit f8f56d45113e5f2467a5e8375186e5db6309dfc6)
+- make test_flatten backwards-compatible (cherry picked from commit d91675ac5ffe907fcdbb3d1cedb1240008d81fd1)
+--- a/src/twisted/persisted/aot.py
++++ b/src/twisted/persisted/aot.py
+@@ -399,8 +399,10 @@ class AOTUnjellier:
+                 inst = klass.__new__(klass)
+                 if hasattr(klass, "__setstate__"):
+                     self.callAfter(inst.__setstate__, state)
+-                else:
++                elif isinstance(state, dict):
+                     inst.__dict__ = state
++                else:
++                    inst.__dict__ = state.__getstate__()
+                 return inst
+ 
+             elif c is Ref:
+--- a/src/twisted/spread/flavors.py
++++ b/src/twisted/spread/flavors.py
+@@ -398,6 +398,8 @@ class RemoteCopy(Unjellyable):
+         object's dictionary (or a filtered approximation of it depending
+         on my peer's perspective).
+         """
++        if not state:
++            state = {}
+         state = {
+             x.decode("utf8") if isinstance(x, bytes) else x: y for x, y in state.items()
+         }
+--- a/src/twisted/spread/jelly.py
++++ b/src/twisted/spread/jelly.py
+@@ -154,7 +154,8 @@ def _newInstance(cls, state):
+     instance = _createBlank(cls)
+ 
+     def defaultSetter(state):
+-        instance.__dict__ = state
++        if isinstance(state, dict):
++            instance.__dict__ = state or {}
+ 
+     setter = getattr(instance, "__setstate__", defaultSetter)
+     setter(state)
+--- a/src/twisted/test/test_persisted.py
++++ b/src/twisted/test/test_persisted.py
+@@ -378,6 +378,10 @@ class AOTTests(TestCase):
+             def __dict__(self):
+                 raise AttributeError()
+ 
++            @property
++            def __getstate__(self):
++                raise AttributeError()
++
+         self.assertRaises(TypeError, aot.jellyToSource, UnknownType())
+ 
+     def test_basicIdentity(self):
+--- a/src/twisted/trial/test/test_pyunitcompat.py
++++ b/src/twisted/trial/test/test_pyunitcompat.py
+@@ -218,8 +218,10 @@ class PyUnitResultTests(SynchronousTestCase):
+         pyresult = pyunit.TestResult()
+         result = PyUnitResultAdapter(pyresult)
+         result.addError(self, f)
++        tback = "".join(traceback.format_exception(*exc_info))
+         self.assertEqual(
+-            pyresult.errors[0][1], "".join(traceback.format_exception(*exc_info))
++            pyresult.errors[0][1].endswith("ZeroDivisionError: division by zero\n"),
++            tback.endswith("ZeroDivisionError: division by zero\n"),
+         )
+ 
+     def test_trialSkip(self):
+--- a/src/twisted/web/test/test_flatten.py
++++ b/src/twisted/web/test/test_flatten.py
+@@ -706,10 +706,9 @@ class FlattenerErrorTests(SynchronousTestCase):
+                     Exception while flattening:
+                       \\[<unrenderable>\\]
+                       <unrenderable>
+-                      .*
++                      <Deferred at .* current result: <twisted.python.failure.Failure builtins.RuntimeError: example>>
+                       File ".*", line \\d*, in _flattenTree
+-                        element = await element
+-                    RuntimeError: example
++                        element = await element.*
+                     """
+                 ),
+                 flags=re.MULTILINE,
+-- 
+2.39.2
+
+

diff --git a/dev-python/twisted/files/twisted-22.10.0-sendmail.patch b/dev-python/twisted/files/twisted-22.10.0-sendmail.patch
new file mode 100644
index 000000000000..eec57752815d
--- /dev/null
+++ b/dev-python/twisted/files/twisted-22.10.0-sendmail.patch
@@ -0,0 +1,28 @@
+https://src.fedoraproject.org/rpms/python-twisted/raw/rawhide/f/0005-fix-sendmail-tests-for-python-3.11.patch
+
+From f29ae1ae433cd9529410a93fd5675cb01460460e Mon Sep 17 00:00:00 2001
+From: eevel <eevel@weezel3.weezelnet>
+Date: Wed, 26 Oct 2022 19:49:33 -0500
+Subject: [PATCH 5/6] fix sendmail tests for python 3.11
+
+(cherry picked from commit 00bf5be704bee022ba4d9b24eb6c2c768b4a1921)
+--- a/src/twisted/mail/test/test_smtp.py
++++ b/src/twisted/mail/test/test_smtp.py
+@@ -1771,7 +1771,8 @@ class SendmailTests(TestCase):
+         The default C{reactor} parameter of L{twisted.mail.smtp.sendmail} is
+         L{twisted.internet.reactor}.
+         """
+-        args, varArgs, keywords, defaults = inspect.getargspec(smtp.sendmail)
++        fullSpec = inspect.getfullargspec(smtp.sendmail)
++        defaults = fullSpec[3]
+         self.assertEqual(reactor, defaults[2])
+ 
+     def _honorsESMTPArguments(self, username, password):
+--- /dev/null
++++ b/src/twisted/newsfragments/10345.misc
+@@ -0,0 +1 @@
++Fix SendmailTests for python 3.11.
+-- 
+2.39.2
+
+

diff --git a/dev-python/twisted/files/twisted-22.10.0-time.patch b/dev-python/twisted/files/twisted-22.10.0-time.patch
new file mode 100644
index 000000000000..1723d69c8a3c
--- /dev/null
+++ b/dev-python/twisted/files/twisted-22.10.0-time.patch
@@ -0,0 +1,113 @@
+From 75e5e6ba1793efdfef2e2cfada0425bad5f0bcfa Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@cs.ucla.edu>
+Date: Fri, 9 Dec 2022 10:16:42 -0800
+Subject: [PATCH 4/6] #11786 fix misuse of mktime in tests
+
+(cherry picked from commit da3bf3dc29f067e7019b2a1c205834ab64b2139a)
+--- a/src/twisted/logger/test/test_format.py
++++ b/src/twisted/logger/test/test_format.py
+@@ -166,16 +166,17 @@ class TimeFormattingTests(unittest.TestCase):
+         def testForTimeZone(name: str, expectedDST: str, expectedSTD: str) -> None:
+             setTZ(name)
+ 
+-            localDST = mktime((2006, 6, 30, 0, 0, 0, 4, 181, 1))
+             localSTD = mktime((2007, 1, 31, 0, 0, 0, 2, 31, 0))
+-
+-            self.assertEqual(formatTime(localDST), expectedDST)
+             self.assertEqual(formatTime(localSTD), expectedSTD)
+ 
++            if expectedDST:
++                localDST = mktime((2006, 6, 30, 0, 0, 0, 4, 181, 1))
++                self.assertEqual(formatTime(localDST), expectedDST)
++
+         # UTC
+         testForTimeZone(
+             "UTC+00",
+-            "2006-06-30T00:00:00+0000",
++            None,
+             "2007-01-31T00:00:00+0000",
+         )
+ 
+@@ -196,7 +197,7 @@ class TimeFormattingTests(unittest.TestCase):
+         # No DST
+         testForTimeZone(
+             "CST+06",
+-            "2006-06-30T00:00:00-0600",
++            None,
+             "2007-01-31T00:00:00-0600",
+         )
+ 
+@@ -211,7 +212,7 @@ class TimeFormattingTests(unittest.TestCase):
+         """
+         If C{timeFormat} argument is L{None}, we get the default output.
+         """
+-        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+         self.assertEqual(formatTime(t, timeFormat=None), "-")
+         self.assertEqual(formatTime(t, timeFormat=None, default="!"), "!")
+ 
+@@ -219,7 +220,7 @@ class TimeFormattingTests(unittest.TestCase):
+         """
+         Alternate time format in output.
+         """
+-        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+         self.assertEqual(formatTime(t, timeFormat="%Y/%W"), "2013/38")
+ 
+     def test_formatTimePercentF(self) -> None:
+@@ -246,7 +247,7 @@ class ClassicLogFormattingTests(unittest.TestCase):
+         addTZCleanup(self)
+         setTZ("UTC+00")
+ 
+-        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+         event = dict(log_format="XYZZY", log_time=t)
+         self.assertEqual(
+             formatEventAsClassicLogText(event),
+@@ -539,7 +540,7 @@ class EventAsTextTests(unittest.TestCase):
+         except CapturedError:
+             f = Failure()
+ 
+-        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+         event: LogEvent = {
+             "log_format": "ABCD",
+             "log_system": "fake_system",
+@@ -573,7 +574,7 @@ class EventAsTextTests(unittest.TestCase):
+         except CapturedError:
+             f = Failure()
+ 
+-        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+         event: LogEvent = {
+             "log_format": "ABCD",
+             "log_system": "fake_system",
+@@ -601,7 +602,7 @@ class EventAsTextTests(unittest.TestCase):
+         except CapturedError:
+             f = Failure()
+ 
+-        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+         event: LogEvent = {
+             "log_format": "ABCD",
+             "log_time": t,
+@@ -628,7 +629,7 @@ class EventAsTextTests(unittest.TestCase):
+         except CapturedError:
+             f = Failure()
+ 
+-        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+         event: LogEvent = {
+             "log_format": "ABCD",
+             "log_time": t,
+@@ -657,7 +658,7 @@ class EventAsTextTests(unittest.TestCase):
+         except CapturedError:
+             f = Failure()
+ 
+-        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, 1))
++        t = mktime((2013, 9, 24, 11, 40, 47, 1, 267, -1))
+         event: LogEvent = {
+             "log_format": "ABCD",
+             "log_time": t,
+-- 
+2.39.2

diff --git a/dev-python/twisted/twisted-22.10.0-r2.ebuild b/dev-python/twisted/twisted-22.10.0-r3.ebuild
similarity index 97%
rename from dev-python/twisted/twisted-22.10.0-r2.ebuild
rename to dev-python/twisted/twisted-22.10.0-r3.ebuild
index 086760de159e..1f8f2ef6a7e9 100644
--- a/dev-python/twisted/twisted-22.10.0-r2.ebuild
+++ b/dev-python/twisted/twisted-22.10.0-r3.ebuild
@@ -84,6 +84,10 @@ BDEPEND="
 PATCHES=(
 	# https://twistedmatrix.com/trac/ticket/10200
 	"${FILESDIR}/${PN}-22.1.0-force-gtk3.patch"
+
+	"${FILESDIR}/${PN}-22.10.0-python3.11-tests.patch"
+	"${FILESDIR}/${PN}-22.10.0-time.patch"
+	"${FILESDIR}/${PN}-22.10.0-sendmail.patch"
 )
 
 python_prepare_all() {


             reply	other threads:[~2023-05-28 23:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-28 23:32 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-18  8:05 [gentoo-commits] repo/gentoo:master commit in: dev-python/twisted/files/, dev-python/twisted/ Petr Vaněk
2024-07-31 15:10 Petr Vaněk
2024-06-28  7:47 Petr Vaněk
2022-10-11  7:27 Michał Górny
2021-10-17  7:15 Michał Górny
2021-07-30 18:14 Michał Górny
2020-05-27 11:00 Michał Górny
2019-09-18 16:23 Michał Górny
2017-05-03  9:26 Michał Górny
2017-03-31 21:11 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1685316712.d2c8622b7c5df457f8ab238774f3e1c3624aecd1.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox