diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-30 18:29:46 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-30 18:29:46 -0700 |
commit | cb42d258c2ca1035cac73e7635992d997f9df735 (patch) | |
tree | 56f94373aec693df9f75a10b90ed6abbc2121a8d /tools | |
parent | 263df2b1e29b8723f9e75594ff0ff480c0d52cc1 (diff) |
check for need to clear cache even in EMCC_DEBUG=1 mode, which forces sanity checks
Diffstat (limited to 'tools')
-rw-r--r-- | tools/shared.py | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/tools/shared.py b/tools/shared.py index a33f16a5..b4dad96f 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -206,25 +206,26 @@ def generate_sanity(): def check_sanity(force=False): try: - if not force: - if not CONFIG_FILE: - return # config stored directly in EM_CONFIG => skip sanity checks + reason = None + if not CONFIG_FILE: + if not force: return # config stored directly in EM_CONFIG => skip sanity checks + else: settings_mtime = os.stat(CONFIG_FILE).st_mtime sanity_file = CONFIG_FILE + '_sanity' - reason = 'unknown' - try: - sanity_mtime = os.stat(sanity_file).st_mtime - if sanity_mtime <= settings_mtime: - reason = 'settings file has changed' - else: - sanity_data = open(sanity_file).read() - if sanity_data != generate_sanity(): - reason = 'system change: %s vs %s' % (generate_sanity(), sanity_data) + if os.path.exists(sanity_file): + try: + sanity_mtime = os.stat(sanity_file).st_mtime + if sanity_mtime <= settings_mtime: + reason = 'settings file has changed' else: - return # all is well - except: - pass - + sanity_data = open(sanity_file).read() + if sanity_data != generate_sanity(): + reason = 'system change: %s vs %s' % (generate_sanity(), sanity_data) + else: + if not force: return # all is well + except Exception, e: + reason = 'unknown: ' + str(e) + if reason: print >> sys.stderr, '(Emscripten: %s, clearing cache)' % reason Cache.erase() |