aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-08-30 15:02:55 +0300
committerJukka Jylänki <jujjyl@gmail.com>2013-08-30 15:02:55 +0300
commit72ace7c3972dac3ba6ee71a17fc82aa7cf5f0326 (patch)
treeb418ffddd2d58de15895c57fe9a0d50405d3ea50 /tools/shared.py
parent3f37ff4332eb24d75eb62a628cb2bd0949842acf (diff)
Output stdout and stderr from external library builds to console only if EMSCRIPTEN_VERBOSE environment variable is defined, to not spam console with information from external tools by default.
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 13958d52..71ef3786 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -894,11 +894,13 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
# except:
# pass
env = Building.get_building_env(native)
+ log_to_file = os.getenv('EMSCRIPTEN_VERBOSE') == None or int(os.getenv('EMSCRIPTEN_VERBOSE')) == 0
for k, v in env_init.iteritems():
env[k] = v
if configure: # Useful in debugging sometimes to comment this out (and the lines below up to and including the |link| call)
try:
- Building.configure(configure + configure_args, env=env)
+ Building.configure(configure + configure_args, env=env, stdout=open(os.path.join(project_dir, 'configure_'), 'w') if log_to_file else None,
+ stderr=open(os.path.join(project_dir, 'configure_err'), 'w') if log_to_file else None)
except subprocess.CalledProcessError, e:
pass # Ignore exit code != 0
def open_make_out(i, mode='r'):
@@ -911,8 +913,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
with open_make_out(i, 'w') as make_out:
with open_make_err(i, 'w') as make_err:
try:
- Building.make(make + make_args, stdout=make_out,
- stderr=make_err, env=env)
+ Building.make(make + make_args, stdout=make_out if log_to_file else None,
+ stderr=make_err if log_to_file else None, env=env)
except subprocess.CalledProcessError, e:
pass # Ignore exit code != 0
try:
@@ -924,10 +926,11 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
break
except Exception, e:
if i > 0:
- # Due to the ugly hack above our best guess is to output the first run
- with open_make_err(0) as ferr:
- for line in ferr:
- sys.stderr.write(line)
+ if log_to_file:
+ # Due to the ugly hack above our best guess is to output the first run
+ with open_make_err(0) as ferr:
+ for line in ferr:
+ sys.stderr.write(line)
raise Exception('could not build library ' + name + ' due to exception ' + str(e))
if old_dir:
os.chdir(old_dir)