From 8a0c54a76bffc7f2e7e1daad2eb4e72252f4feab Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Fri, 12 Apr 2019 09:10:31 +0200 Subject: [PATCH] Newer Python version checker --- tools/check_python_version.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/check_python_version.py b/tools/check_python_version.py index e07caed1..94cae0d7 100644 --- a/tools/check_python_version.py +++ b/tools/check_python_version.py @@ -1,4 +1,17 @@ -"""Check if the installed Python interpreter has correct version.""" +"""Check if the installed Python interpreter has correct version. + +This script has to be called with two command line arguments: +expected_major_version expected_minor_version + +The script then check if actual Python version (major+minor) is +the same or newer than expected version. + +Usage: +python check_python_version.py 2.7 +python3 check_python_version.py 3.6 +python3 check_python_version.py 3.7 +etc. +""" import sys @@ -10,12 +23,14 @@ def get_expected_version(arguments): " python3 check_python_version.py major minor") raise Exception("CLI arguments missing") + # try to read major version try: major = int(arguments[1]) except Exception as e: print("Can not parse major version '{}'".format(arguments[1])) raise e + # try to read minor version try: minor = int(arguments[2]) except Exception as e: