aboutsummaryrefslogtreecommitdiff
path: root/tool/modules/check.py
diff options
context:
space:
mode:
Diffstat (limited to 'tool/modules/check.py')
-rw-r--r--tool/modules/check.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tool/modules/check.py b/tool/modules/check.py
new file mode 100644
index 0000000..2a082f6
--- /dev/null
+++ b/tool/modules/check.py
@@ -0,0 +1,20 @@
+import sys
+import re
+from os.path import *
+
+
+def check_python_version(required_version=(3, 10)):
+ return sys.version_info < required_version
+
+
+def check_ubuntu():
+ if not exists("/etc/os-release"):
+ return False
+ else:
+ with open("/etc/os-release", "r") as f:
+ content = f.read()
+ if re.search(r"NAME=\"?Ubuntu\"?", content, re.IGNORECASE) is None:
+ return False
+ if re.search(r"VERSION_ID=\"?22.04\"?", content, re.IGNORECASE) is None:
+ return False
+ return True