-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdepcheck.py
49 lines (41 loc) · 1.18 KB
/
depcheck.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Dependency check for the project
import subprocess
# Dependency list
DEPENDENCIES = [
"python3",
"pip",
"meson",
"ninja",
]
# Check if the dependency is installed
def check_dependency(dependency):
try:
subprocess.run([dependency, "--version"], shell=False, check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return True
except:
return False
# Check if all dependencies are installed
def check_dependencies():
missing_dependencies = []
# Check if all dependencies are installed
for dependency in DEPENDENCIES:
if not check_dependency(dependency):
missing_dependencies.append(dependency)
# Return the missing dependencies
if len(missing_dependencies) > 0:
return missing_dependencies
else:
return None
# Print the dependency check result
def print_dependency_check():
result = check_dependencies()
# Print the dependency check result
if result is None:
print("\u001b[32m" + "[+] All dependencies are installed")
else:
print("\u001b[30m" + "[-] One or more dependencies are missing!")
for dependency in result:
print("\u001b[30m" + f" [-] Missing: {dependency}")
# Run the dependency check
if __name__ == "__main__":
print_dependency_check()