forked from steinwurf/waf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildbot.py
61 lines (42 loc) · 1.22 KB
/
buildbot.py
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
#!/usr/bin/env python
# encoding: utf-8
import sys
import json
import subprocess
project_name = 'waf'
def run_command(args, cwd=None, env=None):
print("Running: {}".format(args))
sys.stdout.flush()
subprocess.check_call(args, cwd=cwd, env=env)
def configure(properties):
command = [sys.executable, 'waf', 'configure', '-v', '--zones=resolve']
run_command(command)
def build(properties):
command = [sys.executable, 'waf', 'build', '-v', '--zones=resolve']
run_command(command)
def run_tests(properties):
command = [sys.executable, 'waf', '-v', '--run_tests', '--zones=resolve']
run_command(command)
def install(properties):
pass
def main():
argv = sys.argv
if len(argv) < 2:
print("Usage: {} <command> <properties>".format(argv[0]))
sys.exit(0)
cmd = argv[1]
properties = {}
if len(argv) == 3:
properties = json.loads(argv[2])
if cmd == 'configure':
configure(properties)
elif cmd == 'build':
build(properties)
elif cmd == 'run_tests':
run_tests(properties)
elif cmd == 'install':
install(properties)
else:
print("Unknown command: {}".format(cmd))
if __name__ == '__main__':
main()