Rev 9380 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
9367 | Boppan | 1 | import sys |
2 | import os |
||
3 | |||
9374 | Boppan | 4 | path_to_tools_workspace = os.path.dirname(os.path.abspath(__file__)) |
5 | path_to_tools = os.path.dirname(path_to_tools_workspace) |
||
9370 | Boppan | 6 | sys.path.append(path_to_tools) |
9367 | Boppan | 7 | |
9411 | Boppan | 8 | from lib.tupfile_parser import parse_required_compilers, parse_tupfile_outputs |
9 | from lib.logging import require_tools |
||
9367 | Boppan | 10 | |
9379 | Boppan | 11 | def get_executable_file(output_file_list): |
12 | for name in output_file_list: |
||
9377 | Boppan | 13 | if name.endswith(".inc"): |
14 | continue |
||
15 | return name |
||
9367 | Boppan | 16 | |
9379 | Boppan | 17 | def build(): |
9411 | Boppan | 18 | required_compilers = parse_required_compilers("Tupfile.lua") |
19 | require_tools(required_compilers) |
||
9379 | Boppan | 20 | os.system("tup") |
21 | output_file_list = parse_tupfile_outputs("Tupfile.lua") |
||
22 | return get_executable_file(output_file_list) |
||
23 | |||
24 | def clean(): |
||
25 | output_file_list = parse_tupfile_outputs("Tupfile.lua") |
||
26 | for output_file in output_file_list: |
||
9380 | Boppan | 27 | if os.path.exists(output_file): |
28 | os.remove(output_file) |
||
9379 | Boppan | 29 | |
30 | def main(argv): |
||
31 | if len(argv) == 2 and argv[1] == "clean": |
||
32 | clean() |
||
33 | else: |
||
34 | build() |
||
35 | |||
9367 | Boppan | 36 | if __name__ == "__main__": |
9379 | Boppan | 37 | main(sys.argv) |