dev-python/twisted: Bump to python 3.10

Signed-off-by: Ekaterina Vaartis <vaartis@kotobank.ch>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Ekaterina Vaartis
2021-05-16 00:22:13 +03:00
committed by Michał Górny
parent 05a04b933b
commit 28edb49d25
3 changed files with 68 additions and 2 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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