-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·45 lines (36 loc) · 1.31 KB
/
main.py
File metadata and controls
executable file
·45 lines (36 loc) · 1.31 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
#!/usr/bin/env python3
import sys
import os
import json
import works
import utils
import argparse
console = utils.Console()
def main():
parser = argparse.ArgumentParser(description='Reasonable link helper')
parser.add_argument('recipe', metavar='recipe', type=str, nargs=1,
help='Recipe generated by CMaker')
parser.add_argument('--clean-linking', action="store_true", help='clean old linking targets before linking')
parser.add_argument('--clean', '-c', action="store_true", help='clean old results before starting')
args = parser.parse_args()
if len(sys.argv) >= 2 and os.access(sys.argv[1], os.R_OK):
console.log("Cmaker result found:", sys.argv[1])
else:
console.error("Cmaker result not found or unreadable.")
sys.exit(1)
try:
json_data = json.load(open(sys.argv[1]))
assert json_data["scripts"]
assert json_data["compile"]
except:
console.error("Failed to parse Cmaker file")
sys.exit(1)
try:
utils.loadSettings(open("settings.json"))
console.success("Settings loaded.")
except Exception as e:
console.warn("Settings not loaded, because of:", e)
console.debug("Settings", utils.settings)
works.do_process(json_data, args)
if __name__ == "__main__":
main()