Skip to content

Commit eb08372

Browse files
committed
fix creation of temp dir in EMCC_DEBUG for the first time
1 parent 9932b38 commit eb08372

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tools/shared.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,18 @@ def build_clang_tool_path(tool):
456456

457457
# Temp dir. Create a random one, unless EMCC_DEBUG is set, in which case use TEMP_DIR/emscripten_temp
458458

459+
def safe_ensure_dirs(dirname):
460+
try:
461+
os.makedirs(dirname)
462+
except os.error, e:
463+
# Ignore error for already existing dirname
464+
if e.errno != errno.EEXIST:
465+
raise e
466+
# FIXME: Notice that this will result in a false positive,
467+
# should the dirname be a file! There seems to no way to
468+
# handle this atomically in Python 2.x.
469+
# There is an additional option for Python 3.x, though.
470+
459471
class Configuration:
460472
def __init__(self, environ=os.environ):
461473
self.DEBUG = environ.get('EMCC_DEBUG')
@@ -482,7 +494,7 @@ def __init__(self, environ=os.environ):
482494
self.EMSCRIPTEN_TEMP_DIR = self.CANONICAL_TEMP_DIR
483495
safe_ensure_dirs(self.EMSCRIPTEN_TEMP_DIR)
484496
except Exception, e:
485-
logging.debug(str(e) + 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten')
497+
logging.error(str(e) + 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten')
486498

487499
def get_temp_files(self):
488500
return tempfiles.TempFiles(
@@ -1635,17 +1647,5 @@ def unsuffixed(name):
16351647
def unsuffixed_basename(name):
16361648
return os.path.basename(unsuffixed(name))
16371649

1638-
def safe_ensure_dirs(dirname):
1639-
try:
1640-
os.makedirs(dirname)
1641-
except os.error, e:
1642-
# Ignore error for already existing dirname
1643-
if e.errno != errno.EEXIST:
1644-
raise e
1645-
# FIXME: Notice that this will result in a false positive,
1646-
# should the dirname be a file! There seems to no way to
1647-
# handle this atomically in Python 2.x.
1648-
# There is an additional option for Python 3.x, though.
1649-
16501650
import js_optimizer
16511651

0 commit comments

Comments
 (0)