aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-09 14:31:34 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-09 14:31:34 -0700
commit8ffdfa12fb3cff6f60ece2cd8c1fc7149e48e8bc (patch)
tree32bef3380afc2124eb934c1de60b0b91bec1ca29 /tools/shared.py
parent1e5ce6cb081d93efc761b1f70b0d0a43e1f27ca0 (diff)
use unique temp dir in emcc unless EMCC_DEBUG=1 is set
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 04c2eec3..532f561f 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -115,18 +115,20 @@ EXEC_LLVM = path_from_root('tools', 'exec_llvm.py')
VARIABLE_ELIMINATOR = path_from_root('tools', 'eliminator', 'eliminator.coffee')
JS_OPTIMIZER = path_from_root('tools', 'js-optimizer.js')
-# Temp dir
+# Temp dir. Create a random one, unless EMCC_DEBUG is set, in which case use TEMP_DIR/emscripten_temp
-try:
- EMSCRIPTEN_TEMP_DIR = os.path.join(TEMP_DIR, 'emscripten_temp')
- if not os.path.exists(EMSCRIPTEN_TEMP_DIR):
- try:
+EMSCRIPTEN_TEMP_DIR = None
+
+if os.environ.get('EMCC_DEBUG'):
+ try:
+ EMSCRIPTEN_TEMP_DIR = os.path.join(TEMP_DIR, 'emscripten_temp')
+ if not os.path.exists(EMSCRIPTEN_TEMP_DIR):
os.makedirs(EMSCRIPTEN_TEMP_DIR)
- except Exception, e:
- print >> sys.stderr, 'Warning: Could not create temp dir (%s): %s' % (EMSCRIPTEN_TEMP_DIR, str(e))
-except:
+ except:
+ print >> sys.stderr, 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten'
+
+if not EMSCRIPTEN_TEMP_DIR:
EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_')
- print >> sys.stderr, 'Warning: TEMP_DIR not defined in %s, using %s' % (EM_CONFIG, EMSCRIPTEN_TEMP_DIR)
# EM_CONFIG stuff