diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-06 15:14:57 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-06 15:14:57 -0500 |
commit | eb083723747a90cb6ab9853fec8d6e8ef54748bc (patch) | |
tree | 271793c15eec1e838bd7a1633f22c313fcc2990e /tools | |
parent | 9932b38a5e807964d7b64b8714c43bbe345bd267 (diff) |
fix creation of temp dir in EMCC_DEBUG for the first time
Diffstat (limited to 'tools')
-rw-r--r-- | tools/shared.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/shared.py b/tools/shared.py index 46ff7f6f..3eb72a1e 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -456,6 +456,18 @@ 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 +def safe_ensure_dirs(dirname): + try: + os.makedirs(dirname) + except os.error, e: + # Ignore error for already existing dirname + if e.errno != errno.EEXIST: + raise e + # FIXME: Notice that this will result in a false positive, + # should the dirname be a file! There seems to no way to + # handle this atomically in Python 2.x. + # There is an additional option for Python 3.x, though. + class Configuration: def __init__(self, environ=os.environ): self.DEBUG = environ.get('EMCC_DEBUG') @@ -482,7 +494,7 @@ class Configuration: self.EMSCRIPTEN_TEMP_DIR = self.CANONICAL_TEMP_DIR safe_ensure_dirs(self.EMSCRIPTEN_TEMP_DIR) except Exception, e: - logging.debug(str(e) + 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten') + logging.error(str(e) + 'Could not create canonical temp dir. Check definition of TEMP_DIR in ~/.emscripten') def get_temp_files(self): return tempfiles.TempFiles( @@ -1635,17 +1647,5 @@ def unsuffixed(name): def unsuffixed_basename(name): return os.path.basename(unsuffixed(name)) -def safe_ensure_dirs(dirname): - try: - os.makedirs(dirname) - except os.error, e: - # Ignore error for already existing dirname - if e.errno != errno.EEXIST: - raise e - # FIXME: Notice that this will result in a false positive, - # should the dirname be a file! There seems to no way to - # handle this atomically in Python 2.x. - # There is an additional option for Python 3.x, though. - import js_optimizer |