From 1c047353a95e7ac079ccf89af8fc232451b8f891 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Sat, 17 Apr 2021 09:57:10 +0200 Subject: [PATCH] [bin/cdist] Fix Python version check --- bin/cdist | 8 +++++--- cdist/__init__.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/cdist b/bin/cdist index ddaffa7f..adb06a8d 100755 --- a/bin/cdist +++ b/bin/cdist @@ -72,9 +72,11 @@ def commandline(): if __name__ == "__main__": - if sys.version < cdist.MIN_SUPPORTED_PYTHON_VERSION: - print('Python >= {} is required on the source host.'.format( - cdist.MIN_SUPPORTED_PYTHON_VERSIO), file=sys.stderr) + if sys.version_info[:3] < cdist.MIN_SUPPORTED_PYTHON_VERSION: + print( + 'Python >= {} is required on the source host.'.format( + ".".join(map(str, cdist.MIN_SUPPORTED_PYTHON_VERSION))), + file=sys.stderr) sys.exit(1) exit_code = 0 diff --git a/cdist/__init__.py b/cdist/__init__.py index 44366cd0..31d49889 100644 --- a/cdist/__init__.py +++ b/cdist/__init__.py @@ -64,7 +64,7 @@ REMOTE_EXEC = "ssh -o User=root" REMOTE_CMDS_CLEANUP_PATTERN = "ssh -o User=root -O exit -S {}" -MIN_SUPPORTED_PYTHON_VERSION = '3.5' +MIN_SUPPORTED_PYTHON_VERSION = (3, 5) class Error(Exception):