-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild
executable file
·78 lines (53 loc) · 1.61 KB
/
build
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/python3
import shutil
import subprocess as sp
#- small class for Terminal color-printing
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
#- query terminal-window dimensions
def getTerminalSize():
return shutil.get_terminal_size()
#- prints potentially useful information to the developer in
#- an easy-to-read form
def announce(message):
if not message.endswith(' '): message += ' '
if not message.startswith(' '): message = (' ' + message)
(width, height) = getTerminalSize()
if len(message) % 2 != 0:
message += ' '
coln = ((width - len(str(message))) // 2)
padding = ("=" * (coln -2))
lpadding = ('#' + padding + '>')
rpadding = ('<' + padding + '#')
main_line = (lpadding + str(message) + rpadding)
line = ('#' + ("=" * (width - 2)) + '#')
print('\n' + line)
print(main_line)
print(line + '\n')
def note(messg):
(w, h) = getTerminalSize()
line = ((" " * 4) + '<=> ')
print(line)
def command(command, *clargs):
args = ([command] + list(clargs))
p = sp.Popen(args, **{
'stdin' : sp.PIPE,
'stdout' : sp.PIPE,
'stderr' : sp.PIPE
})
status = p.communicate()
return status
buildfile = lambda target: ("build-files/build-{0}.hxml".format( str(target) ))
def javascript():
announce("Compiling PromiScript to JavaScript")
js_update = command('haxe-nightly', buildfile('js'))
#- main entry-point to the program
def main():
javascript()
if __name__ == '__main__':
main()