aboutsummaryrefslogtreecommitdiff
path: root/tools/aio/modules/check.py
blob: 2a082f611a085f2b4b8530bcbdc4f2ad82f94776 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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