forked from linn/oss-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildLayouts.py
executable file
·44 lines (32 loc) · 918 Bytes
/
buildLayouts.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
#! /usr/bin/env python
import os
import sys
import subprocess
def usage():
print "usage:"
print "$0 variant [target] [-c]"
print "variant: scons configuration (ex variant=release)"
print "target: optional target for all subdirs (ex Lib)"
print "-c: optional clean"
if (sys.argv[1] == "--help"):
usage()
sys.exit()
if (sys.argv[1] == "-h"):
usage()
sys.exit()
def build(path):
externalProgram = 'scons'
#navigate to folder to build at
for folder in path:
os.chdir(folder)
#pass command arguments
for i in range(1, len(sys.argv)):
externalProgram += ' ' + sys.argv[i]
retcode = subprocess.call(externalProgram, shell=True)
#return to path before function call
for folder in path:
os.chdir('..')
#if an error occurred in the build exit
if not retcode == 0:
exit()
build(['Layouts'])