diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-08 11:47:14 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-08 11:47:14 -0400 |
commit | 0a229cf5a240a1ebf4ff5d0ebb501a286bc96202 (patch) | |
tree | 2797d054788e88863d77f9826dde94fb4c276c69 /tools/shared.py | |
parent | 05b6aa32a5f1633797f7eae390b3a8048b29ca69 (diff) | |
parent | ae5ef852920ce67449af7693f05a767a87aed976 (diff) |
Merge branch 'incoming'
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/tools/shared.py b/tools/shared.py index 2d9ae9f6..b3c3257b 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -47,6 +47,7 @@ class WindowsPopen: try: # Call the process with fixed streams. self.process = subprocess.Popen(args, bufsize, executable, self.stdin_, self.stdout_, self.stderr_, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags) + self.pid = self.process.pid except Exception, e: logging.error('\nsubprocess.Popen(args=%s) failed! Exception %s\n' % (' '.join(args), str(e))) raise e @@ -84,10 +85,6 @@ class WindowsPopen: except: pass # Mute all exceptions in dtor, particularly if we didn't use a response file, self.response_filename doesn't exist. -# Install our replacement Popen handler if we are running on Windows to avoid python spawn process function. -if os.name == 'nt': - Popen = WindowsPopen - __rootpath__ = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) def path_from_root(*pathelems): return os.path.join(__rootpath__, *pathelems) @@ -250,6 +247,19 @@ except Exception, e: logging.error('Error in evaluating %s (at %s): %s, text: %s' % (EM_CONFIG, CONFIG_FILE, str(e), config_text)) sys.exit(1) +try: + EM_POPEN_WORKAROUND +except: + EM_POPEN_WORKAROUND = os.environ.get('EM_POPEN_WORKAROUND') + +# Install our replacement Popen handler if we are running on Windows to avoid python spawn process function. +# nb. This is by default disabled since it has the adverse effect of buffering up all logging messages, which makes +# builds look unresponsive (messages are printed only after the whole build finishes). Whether this workaround is needed +# seems to depend on how the host application that invokes emcc has set up its stdout and stderr. +if EM_POPEN_WORKAROUND and os.name == 'nt': + logging.debug('Installing Popen workaround handler to avoid bug http://bugs.python.org/issue3905') + Popen = WindowsPopen + # Expectations EXPECTED_LLVM_VERSION = (3,2) @@ -304,7 +314,7 @@ def find_temp_directory(): # we re-check sanity when the settings are changed) # We also re-check sanity and clear the cache when the version changes -EMSCRIPTEN_VERSION = '1.6.1' +EMSCRIPTEN_VERSION = '1.6.4' def generate_sanity(): return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + '|' + LLVM_ROOT @@ -354,7 +364,7 @@ def check_sanity(force=False): logging.critical('Node.js (%s) does not seem to work, check the paths in %s' % (NODE_JS, EM_CONFIG)) sys.exit(1) - for cmd in [CLANG, LINK_CMD[0], LLVM_AR, LLVM_OPT, LLVM_AS, LLVM_DIS, LLVM_NM]: + for cmd in [CLANG, LINK_CMD[0], LLVM_AR, LLVM_OPT, LLVM_AS, LLVM_DIS, LLVM_NM, LLVM_INTERPRETER]: if not os.path.exists(cmd) and not os.path.exists(cmd + '.exe'): # .exe extension required for Windows logging.critical('Cannot find %s, check the paths in %s' % (cmd, EM_CONFIG)) sys.exit(1) @@ -748,7 +758,6 @@ class Settings2(type): self.attrs['ASM_JS'] = 1 self.attrs['ASSERTIONS'] = 0 self.attrs['DISABLE_EXCEPTION_CATCHING'] = 1 - self.attrs['EMIT_GENERATED_FUNCTIONS'] = 1 if opt_level >= 2: self.attrs['RELOOP'] = 1 self.attrs['ALIASING_FUNCTION_POINTERS'] = 1 @@ -1450,7 +1459,15 @@ class Building: logging.error('bootstrapping relooper failed. You may need to manually create relooper.js by compiling it, see src/relooper/emscripten') try_delete(relooper) # do not leave a phase-1 version if phase 2 broke 1/0 - + + @staticmethod + def ensure_struct_info(info_path): + if os.path.exists(info_path): return + Cache.ensure() + + import gen_struct_info + gen_struct_info.main(['-qo', info_path, path_from_root('src/struct_info.json')]) + @staticmethod def preprocess(infile, outfile): ''' |