Add Python Version Check to Python Scripts

ISSUE #204 : Running on versions prior to 3.10 will fail, due to
the use of `match` statements. Other parts of the script assume
a recent Python also, and the system as a whole expects a recent
version of Ubuntu.

`pythonCheck.py` polls `sys.version_info` to detect the in-use
version of Python. If the version is prior to 3.10, it bails out
with the message "LibreQoS requires Python 3.10 or greater".

This should help with outdated OS detection in general.
This commit is contained in:
Herbert Wolverson committed 2023-02-15 15:00:53 +00:00
1 parent 85caa6be19
commit f8f438e8d7
4 files changed
+20 -1

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
import os
def checkPythonVersion():
# Perform a version check
import sys
print("Running Python Version " + sys.version)
version_ok = True
if sys.version_info[0] < 3:
version_ok = False
if sys.version_info[0]==3 and sys.version_info[1] < 10:
version_ok = False
if version_ok == False:
print("LibreQoS requires Python 3.10 or greater.")
os._exit(-1)