[X2Go-Commits] [python-x2go] 01/01: x2go/_paramiko.py: stop monkey-patching very old paramiko versions with the private key fix for Python 3.

git-admin at x2go.org git-admin at x2go.org
Wed Jan 1 07:33:30 CET 2020


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository python-x2go.

commit 68cebc8a818a4f429840f5ec50b9665a784c258c
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Jan 1 07:32:04 2020 +0100

    x2go/_paramiko.py: stop monkey-patching very old paramiko versions with the private key fix for Python 3.
    
    We don't care for Python-3-compatibility there and they implement
    serialization on their own anyway.
---
 debian/changelog  | 4 ++++
 x2go/_paramiko.py | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 4093c16..6c0a869 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,10 @@ python-x2go (0.6.1.3-0x2go1) UNRELEASED; urgency=medium
   [ Mihai Moldovan ]
   * New upstream version (0.6.1.3):
     - Makefile.docupload: make sphinx-apidoc overridable/configurable.
+    - x2go/_paramiko.py: stop monkey-patching very old paramiko versions with
+      the private key fix for Python 3. We don't care for
+      Python-3-compatibility there and they implement serialization on their
+      own anyway.
   * python-x2go.spec:
     + Call a more specialized version of sphinx-apidoc depending on the Python
       version we're building against. When building for Python 3, use the
diff --git a/x2go/_paramiko.py b/x2go/_paramiko.py
index c2e31e8..2e6c9c2 100644
--- a/x2go/_paramiko.py
+++ b/x2go/_paramiko.py
@@ -35,7 +35,6 @@ except ImportError:
 import platform
 from x2go.utils import compare_versions
 
-from cryptography.hazmat.primitives import serialization
 
 PARAMIKO_VERSION = paramiko.__version__.split()[0]
 PARAMIKO_FEATURE = {
@@ -45,9 +44,14 @@ PARAMIKO_FEATURE = {
     'host-entries-reloadable': compare_versions(PARAMIKO_VERSION, ">=", '1.11.0'),
     'preserve-known-hosts': compare_versions(PARAMIKO_VERSION, ">=", '1.11.0'),
     'ecdsa-hostkeys': compare_versions(PARAMIKO_VERSION, ">=", '1.11.6'),
-    'write-private-key-py3': False,
+    # Older versions implement the serialization directly, and we don't really
+    # care for broken or working Python-3-implementations with those.
+    'write-private-key-py3': compare_versions(PARAMIKO_VERSION, '<', '2.0.0'),
 }
 
+if not PARAMIKO_FEATURE['write-private-key-py3']:
+    from cryptography.hazmat.primitives import serialization
+
 def _Pkey_write_private_key(self, f, key, format, password=None):
     """\
     See https://github.com/paramiko/paramiko/pull/1583/

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/python-x2go.git


More information about the x2go-commits mailing list