commit:     28edb49d257baa865d6fa94e1ab9e1a8a29a8d1f
Author:     Ekaterina Vaartis <vaartis <AT> kotobank <DOT> ch>
AuthorDate: Sat May 15 21:22:13 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jun  1 20:35:34 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28edb49d

dev-python/twisted: Bump to python 3.10

Signed-off-by: Ekaterina Vaartis <vaartis <AT> kotobank.ch>
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../twisted/files/twisted-21.2.0-force-gtk3.patch  | 42 ++++++++++++++++++++++
 .../files/twisted-21.2.0-int-from-bytes.patch      | 14 ++++++++
 ...sted-21.2.0.ebuild => twisted-21.2.0-r1.ebuild} | 14 ++++++--
 3 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/dev-python/twisted/files/twisted-21.2.0-force-gtk3.patch 
b/dev-python/twisted/files/twisted-21.2.0-force-gtk3.patch
new file mode 100644
index 00000000000..bed31bcf611
--- /dev/null
+++ b/dev-python/twisted/files/twisted-21.2.0-force-gtk3.patch
@@ -0,0 +1,42 @@
+diff --git a/src/twisted/internet/gireactor.py 
b/src/twisted/internet/gireactor.py
+index 92596db1da2..a577825a87e 100644
+--- a/src/twisted/internet/gireactor.py
++++ b/src/twisted/internet/gireactor.py
+@@ -24,6 +24,7 @@
+ from twisted.internet.error import ReactorAlreadyRunning
+ from twisted.internet import _glibbase
+ from twisted.python import runtime
++import gi
+ import gi.pygtkcompat
+ from gi.repository import GLib
+ 
+@@ -68,6 +69,7 @@ class GIReactor(_glibbase.GlibReactorBase):
+     def __init__(self, useGtk=False):
+         _gtk = None
+         if useGtk is True:
++            gi.require_version("Gtk", "3.0")
+             from gi.repository import Gtk as _gtk
+ 
+         _glibbase.GlibReactorBase.__init__(self, GLib, _gtk, useGtk=useGtk)
+@@ -112,6 +114,7 @@ class PortableGIReactor(_glibbase.PortableGlibReactorBase):
+     def __init__(self, useGtk=False):
+         _gtk = None
+         if useGtk is True:
++            gi.require_version("Gtk", "3.0")
+             from gi.repository import Gtk as _gtk
+ 
+         _glibbase.PortableGlibReactorBase.__init__(self, GLib, _gtk, 
useGtk=useGtk)
+diff --git a/src/twisted/internet/test/test_gireactor.py 
b/src/twisted/internet/test/test_gireactor.py
+index d15a9262248..af5092a3614 100644
+--- a/src/twisted/internet/test/test_gireactor.py
++++ b/src/twisted/internet/test/test_gireactor.py
+@@ -25,6 +25,9 @@
+         gtk3reactor = None
+     else:
+         gtk3reactor = _gtk3reactor
++        import gi  # type: ignore[import]
++
++        gi.require_version("Gtk", "3.0")
+         from gi.repository import Gtk
+ 
+ from twisted.internet.error import ReactorAlreadyRunning

diff --git a/dev-python/twisted/files/twisted-21.2.0-int-from-bytes.patch 
b/dev-python/twisted/files/twisted-21.2.0-int-from-bytes.patch
new file mode 100644
index 00000000000..ef9bd777ac7
--- /dev/null
+++ b/dev-python/twisted/files/twisted-21.2.0-int-from-bytes.patch
@@ -0,0 +1,14 @@
+diff --git a/src/twisted/conch/ssh/common.py b/src/twisted/conch/ssh/common.py
+index 3e4f8cdc7..ee3d63143 100644
+--- a/src/twisted/conch/ssh/common.py
++++ b/src/twisted/conch/ssh/common.py
+@@ -11,7 +11,8 @@ Maintainer: Paul Swartz
+ 
+ import struct
+ 
+-from cryptography.utils import int_from_bytes, int_to_bytes
++from cryptography.utils import int_to_bytes
++int_from_bytes = int.from_bytes
+ 
+ from twisted.python.deprecate import deprecated
+ from twisted.python.versions import Version

diff --git a/dev-python/twisted/twisted-21.2.0.ebuild 
b/dev-python/twisted/twisted-21.2.0-r1.ebuild
similarity index 92%
rename from dev-python/twisted/twisted-21.2.0.ebuild
rename to dev-python/twisted/twisted-21.2.0-r1.ebuild
index d62ac660826..5d0d092f5d4 100644
--- a/dev-python/twisted/twisted-21.2.0.ebuild
+++ b/dev-python/twisted/twisted-21.2.0-r1.ebuild
@@ -3,8 +3,7 @@
 
 EAPI=7
 
-DISTUTILS_USE_SETUPTOOLS=rdepend
-PYTHON_COMPAT=( python3_{7..9} )
+PYTHON_COMPAT=( python3_{7..10} )
 PYTHON_REQ_USE="threads(+)"
 
 inherit distutils-r1 virtualx
@@ -77,6 +76,13 @@ BDEPEND="
        )
 "
 
+PATCHES=(
+       # https://twistedmatrix.com/trac/ticket/10200
+       "${FILESDIR}/${P}-force-gtk3.patch"
+       # int_from_bytes is deprecated
+       "${FILESDIR}/${P}-int-from-bytes.patch"
+)
+
 python_prepare_all() {
        eapply "${FILESDIR}"/${P}-incremental-21.patch
 
@@ -101,6 +107,10 @@ python_prepare_all() {
     skip = "Requires extra permissions"' \
                -i src/twisted/pair/test/test_tuntap.py || die
 
+       # These tests rely on warnings which seems work unreliably between 
python versions
+       sed -e 's:test_currentEUID:_&:' \
+               -e 's:test_currentUID:_&:' -i 
src/twisted/python/test/test_util.py || die
+
        # relies on the pre-CVE parse_qs() behavior in Python
        sed -e '/d=c;+=f/d' \
                -i src/twisted/web/test/test_http.py || die

Reply via email to