Subversion Repositories Kolibri OS

Rev

Rev 9379 | Go to most recent revision | 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
 
9377 Boppan 8
from lib.tupfile_parser import parse_tupfile_outputs
9367 Boppan 9
 
9379 Boppan 10
def get_executable_file(output_file_list):
11
    for name in output_file_list:
9377 Boppan 12
        if name.endswith(".inc"):
13
            continue
14
        return name
9367 Boppan 15
 
9379 Boppan 16
def build():
17
    os.system("tup")
18
    output_file_list = parse_tupfile_outputs("Tupfile.lua")
19
    return get_executable_file(output_file_list)
20
 
21
def clean():
22
    output_file_list = parse_tupfile_outputs("Tupfile.lua")
23
    for output_file in output_file_list:
9380 Boppan 24
        if os.path.exists(output_file):
25
            os.remove(output_file)
9379 Boppan 26
 
27
def main(argv):
28
    if len(argv) == 2 and argv[1] == "clean":
29
        clean()
30
    else:
31
        build()
32
 
9367 Boppan 33
if __name__ == "__main__":
9379 Boppan 34
    main(sys.argv)