diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/shared.py | 17 |
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) |