aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-09-24 12:58:07 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-09-24 12:58:07 -0700
commit8447be68d839d591b8155b5934e479ee316ecc37 (patch)
tree97883c5455417afd683e0d960d0cb58e0ef6eb9e
parentf8390d9665e8b201ee1c1296a1d5493aebbecaca (diff)
parentf80aaf3f444d8a12b05a4166f7648538f68ec633 (diff)
Merge pull request #582 from LCID-Fire/build_error_output
Reworked `build_library`:
-rw-r--r--tools/shared.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 8adff34a..c0c48b68 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -550,9 +550,16 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
if configure: # Useful in debugging sometimes to comment this out (and the lines below up to and including the |link| call)
Building.configure(configure + configure_args, stdout=open(os.path.join(project_dir, 'configure_'), 'w'),
stderr=open(os.path.join(project_dir, 'configure_err'), 'w'), env=env)
- for i in range(2): # workaround for some build systems that need to be run twice to succeed (e.g. poppler)
- Building.make(make + make_args, stdout=open(os.path.join(project_dir, 'make_' + str(i)), 'w'),
- stderr=open(os.path.join(project_dir, 'make_err' + str(i)), 'w'), env=env)
+ def openMakeOut(i, mode='r'):
+ return open(os.path.join(project_dir, 'make_' + str(i)), mode)
+
+ def openMakeErr(i, mode='r'):
+ return open(os.path.join(project_dir, 'make_err' + str(i)), mode)
+
+ for i in range(2): # FIXME: Sad workaround for some build systems that need to be run twice to succeed (e.g. poppler)
+ with openMakeOut(i, 'w') as make_out, openMakeErr(i, 'w') as make_err:
+ Building.make(make + make_args, stdout=make_out,
+ stderr=make_err, env=env)
try:
if cache is not None:
cache[cache_name] = []
@@ -561,7 +568,12 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
cache[cache_name].append((basename, open(f, 'rb').read()))
break
except:
- if i > 0: raise Exception('could not build library ' + name)
+ if i > 0:
+ # Due to the ugly hack above our best guess is to output the first run
+ with openMakeErr(0) as ferr:
+ for line in ferr:
+ sys.stderr.write(line)
+ raise Exception('could not build library ' + name)
if old_dir:
os.chdir(old_dir)
return generated_libs