aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-09-04 19:13:54 +0300
committerJukka Jylänki <jujjyl@gmail.com>2013-09-04 19:13:54 +0300
commita531065786f37493ebb67df5f3d780d6ccbce14d (patch)
tree7d4f124cdca8fc0960d74dcff81bbc76c1140f9d /tools/shared.py
parent270420f77d0032f1bc9cfdbe89e21422977082cb (diff)
Adjust EM_BUILD_VERBOSE environment variable to take values 0,1,2 or 3, with the following meanings:
0 - No verbose build. Emscripten will mute stdout and stderr invokations of external tools (configure, cmake, make). Stdout and stderr of those runs will be logged to file (the old mechanism) 1 - Print stderr. 2 - Print stderr and stdout. 3 - Print stderr and stdout, and invoke make with VERBOSE=1.
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 1426e792..59464d14 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -877,13 +877,13 @@ class Building:
# except:
# pass
env = Building.get_building_env(native)
- log_to_file = os.getenv('EM_BUILD_VERBOSE') == None or int(os.getenv('EM_BUILD_VERBOSE')) == 0
+ verbose_level = int(os.getenv('EM_BUILD_VERBOSE')) if os.getenv('EM_BUILD_VERBOSE') != None else 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, 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)
+ Building.configure(configure + configure_args, env=env, stdout=open(os.path.join(project_dir, 'configure_'), 'w') if verbose_level < 2 else None,
+ stderr=open(os.path.join(project_dir, 'configure_err'), 'w') if verbose_level < 1 else None)
except subprocess.CalledProcessError, e:
pass # Ignore exit code != 0
def open_make_out(i, mode='r'):
@@ -891,13 +891,16 @@ class Building:
def open_make_err(i, mode='r'):
return open(os.path.join(project_dir, 'make_err' + str(i)), mode)
-
+
+ if verbose_level >= 3:
+ make_args += ['VERBOSE=1']
+
for i in range(2): # FIXME: Sad workaround for some build systems that need to be run twice to succeed (e.g. poppler)
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 if log_to_file else None,
- stderr=make_err if log_to_file else None, env=env)
+ Building.make(make + make_args, stdout=make_out if verbose_level < 2 else None,
+ stderr=make_err if verbose_level < 1 else None, env=env)
except subprocess.CalledProcessError, e:
pass # Ignore exit code != 0
try:
@@ -909,7 +912,7 @@ class Building:
break
except Exception, e:
if i > 0:
- if log_to_file:
+ if verbose_level == 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: