diff options
-rwxr-xr-x | emcc | 1 | ||||
-rw-r--r-- | tools/shared.py | 23 |
2 files changed, 15 insertions, 9 deletions
@@ -836,6 +836,7 @@ try: DEBUG = 1 shared.set_logging() logging.debug('invocation: ' + ' '.join(sys.argv)) + shared.apply_configuration() # reset config to pick up change newargs[i] = '' elif newargs[i].startswith('--shell-file'): check_bad_eq(newargs[i]) diff --git a/tools/shared.py b/tools/shared.py index db8f7a56..fdd577de 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -420,7 +420,7 @@ FILE_PACKAGER = path_from_root('tools', 'file_packager.py') # Temp dir. Create a random one, unless EMCC_DEBUG is set, in which case use TEMP_DIR/emscripten_temp class Configuration: - def __init__(self, environ): + def __init__(self, environ=os.environ): self.DEBUG = environ.get('EMCC_DEBUG') if self.DEBUG == "0": self.DEBUG = None @@ -448,11 +448,14 @@ class Configuration: tmp=self.TEMP_DIR if not self.DEBUG else self.EMSCRIPTEN_TEMP_DIR, save_debug_files=os.environ.get('EMCC_DEBUG_SAVE')) -configuration = Configuration(environ=os.environ) -DEBUG = configuration.DEBUG -EMSCRIPTEN_TEMP_DIR = configuration.EMSCRIPTEN_TEMP_DIR -DEBUG_CACHE = configuration.DEBUG_CACHE -CANONICAL_TEMP_DIR = configuration.CANONICAL_TEMP_DIR +def apply_configuration(): + configuration = Configuration() + global configuration, DEBUG, EMSCRIPTEN_TEMP_DIR, DEBUG_CACHE, CANONICAL_TEMP_DIR + DEBUG = configuration.DEBUG + EMSCRIPTEN_TEMP_DIR = configuration.EMSCRIPTEN_TEMP_DIR + DEBUG_CACHE = configuration.DEBUG_CACHE + CANONICAL_TEMP_DIR = configuration.CANONICAL_TEMP_DIR +apply_configuration() logging.basicConfig(format='%(levelname)-8s %(name)s: %(message)s') def set_logging(): @@ -462,9 +465,11 @@ set_logging() if not EMSCRIPTEN_TEMP_DIR: EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_', dir=configuration.TEMP_DIR) - def clean_temp(): - try_delete(EMSCRIPTEN_TEMP_DIR) - atexit.register(clean_temp) + def prepare_to_clean_temp(d): + def clean_temp(): + try_delete(d) + atexit.register(clean_temp) + prepare_to_clean_temp(EMSCRIPTEN_TEMP_DIR) # this global var might change later # EM_CONFIG stuff |