aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-24 21:27:18 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-06-24 21:27:31 -0700
commite7dfdb3a27887f555f2ec3216e8e458257674b25 (patch)
tree28dd853344c9d6d11e48ef571cdd469f99e4f27e
parent682da36db9b39c9069b6a479c1ad9b14677deda4 (diff)
make emcc -v update debug settings, so that it saves temp files
-rwxr-xr-xemcc1
-rw-r--r--tools/shared.py23
2 files changed, 15 insertions, 9 deletions
diff --git a/emcc b/emcc
index 8368f3b1..3bc35aa4 100755
--- a/emcc
+++ b/emcc
@@ -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