-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.py
More file actions
executable file
·62 lines (49 loc) · 1.62 KB
/
bootstrap.py
File metadata and controls
executable file
·62 lines (49 loc) · 1.62 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2024 The JoynRide Authors and CCOS-USP <https://ccos.icmc.usp.br>
#
# SPDX-License-Identifier: GPL-3.0-or-later
## Run this script to set up the development and build environment.
## The script will check for dependencies and initialize configuration files.
import subprocess
##
## Check for tools.
##
import re
import shutil
import subprocess
import sys
def check_dev_tool(tool_name):
# Look for the tool in the system's PATH
print(f"checking for {tool_name}: {''.ljust(30 - len(tool_name) - 1)}", end='')
if shutil.which(tool_name) is not None:
print(f"yes")
return True
else:
print(f"no (developer tool)")
return False
def check_tool(tool_name):
# Look for the tool in the system's PATH
print(f"checking for {tool_name}: {''.ljust(30 - len(tool_name) - 1)}", end='')
if shutil.which(tool_name) is not None:
print(f"yes")
else:
print(f"no (required; please install.)")
sys.exit(1)
def check_reuse():
if check_dev_tool("reuse"):
version = subprocess.run(["reuse", "--version"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text = True).stdout
print(f"Cheking for version number to be 4.*.*:\t\t", end='')
if re.search(r"4\.\d+\.\d+", version) is not None:
print("yes")
else:
print("no")
def main():
# Check for developer tools.
check_reuse();
# Check for build resources.
check_tool("go")
if __name__ == "__main__":
main()