diff options
author | Chad Austin <chad@imvu.com> | 2013-02-01 14:07:23 -0800 |
---|---|---|
committer | Chad Austin <chad@imvu.com> | 2013-03-04 19:31:47 -0800 |
commit | f507b18f6a21731618ac8042802b05eb23d79543 (patch) | |
tree | 93851b2d5d550fd4ebf2f8111335accf7af59421 | |
parent | fd4fec473e627336117b61590e1e0c039dd87919 (diff) |
emscripten.py no longer globally depends on tools.shared
-rwxr-xr-x | emscripten.py | 13 | ||||
-rw-r--r-- | tools/tempfiles.py | 8 |
2 files changed, 16 insertions, 5 deletions
diff --git a/emscripten.py b/emscripten.py index f709821e..f18b69b8 100755 --- a/emscripten.py +++ b/emscripten.py @@ -11,7 +11,7 @@ headers, for the libc implementation in JS). import os, sys, json, optparse, subprocess, re, time, multiprocessing, functools -from tools import shared, jsrun, cache as cache_module, tempfiles +from tools import jsrun, cache as cache_module, tempfiles __rootpath__ = os.path.abspath(os.path.dirname(__file__)) def path_from_root(*pathelems): @@ -20,8 +20,6 @@ def path_from_root(*pathelems): """ return os.path.join(__rootpath__, *pathelems) -configuration = shared.Configuration(environ=os.environ) - def scan(ll, settings): # blockaddress(@main, %23) blockaddrs = [] @@ -493,7 +491,7 @@ Runtime.stackRestore = function(top) { asm.stackRestore(top) }; outfile.close() -def main(args, compiler_engine, cache, jcache, relooper, temp_files): +def main(args, compiler_engine, cache, jcache, relooper, temp_files, configuration): # Prepare settings for serialization to JSON. settings = {} for setting in args.settings: @@ -571,6 +569,7 @@ def main(args, compiler_engine, cache, jcache, relooper, temp_files): if not relooper: relooper = cache.get_path('relooper.js') settings.setdefault('RELOOPER', relooper) + from tools import shared shared.Building.ensure_relooper(relooper) emscript(configuration, args.infile, settings, args.outfile, libraries, @@ -638,6 +637,8 @@ WARNING: You should normally never use this! Use emcc instead. else: relooper = None # use the cache + from tools import shared + configuration = shared.Configuration(environ=os.environ) temp_files = configuration.get_temp_files() if keywords.compiler is None: @@ -651,7 +652,9 @@ WARNING: You should normally never use this! Use emcc instead. cache=cache, jcache=cache_module.JCache(cache) if keywords.jcache else None, relooper=relooper, - temp_files=temp_files)) + temp_files=temp_files, + configuration=configuration + )) if __name__ == '__main__': _main(environ=os.environ) diff --git a/tools/tempfiles.py b/tools/tempfiles.py new file mode 100644 index 00000000..1953691e --- /dev/null +++ b/tools/tempfiles.py @@ -0,0 +1,8 @@ +import os +import shutil + +def try_delete(filename): + try: + os.unlink(filename) + except: + shutil.rmtree(filename, ignore_errors=True) |