build.py: Beautify output

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-05-07 14:18:18 +00:00
commit 9440355423

View file

@ -25,7 +25,7 @@ def find_proj_path(name):
for sub in search_path:
path=proj_base + "/" + sub + "/" + name
if os.path.exists(path):
return path
return os.path.abspath(path)
raise Exception("module " + name + " not found below " + proj_base)
def read_deps(cur, prereq_type):
@ -86,14 +86,18 @@ def run_make(module, target):
cur_project=cur_project+1
make_cmd = "make " + target + " 2>&1"
path = find_proj_path(module)
print(',---------- %d/%d: running %s in %s -------------------------- >' % (cur_project, len(order), make_cmd, path))
delim_len=120
delim='---- %d/%d: running %s in %s -' % (cur_project, len(order), make_cmd, path)
delim = delim + '-' * (delim_len - len(delim))
print(',' + delim + ' >')
os.chdir(path)
p = subprocess.Popen(make_cmd, shell=True, stdout=subprocess.PIPE)
for line in iter(p.stdout.readline, ''):
sys.stdout.write('| ' + line) # avoid extra newlines from print()
sys.stdout.flush()
p.wait()
print('`---------- %d/%d: running %s in %s -------------------------- <' % (cur_project, len(order), make_cmd, path))
print('`' + delim + ' <')
if p.returncode:
print(make_cmd + ' failed')
raise Exception(time.strftime("%Y-%m-%d %H:%M") + ": failed to make target " + target + " in module " + module + " below base " + proj_base)