From 306fd0624c04e09cbf9a001b9afc63229b02de75 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Mon, 26 Jun 2023 10:45:18 +0100 Subject: [PATCH] devlib/utils/ssh: Avoid using deprecated distutils --- devlib/utils/ssh.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index 1f517a3..23b0a6e 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -42,11 +42,13 @@ logging.getLogger("paramiko").setLevel(logging.WARNING) # pylint: disable=import-error,wrong-import-position,ungrouped-imports,wrong-import-order import pexpect -from distutils.version import StrictVersion as V -if V(pexpect.__version__) < V('4.0.0'): - import pxssh -else: + +try: from pexpect import pxssh +# pexpect < 4.0.0 does not have a pxssh module +except ImportError: + import pxssh + from pexpect import EOF, TIMEOUT, spawn # pylint: disable=redefined-builtin,wrong-import-position