def store(self): build_cache = self.bld_root.make_node(BUILD_CACHE) tmp_fid = open(build_cache.abspath() + ".tmp", "wb") try: dump(self.cache, tmp_fid) finally: tmp_fid.close() rename(build_cache.abspath() + ".tmp", build_cache.abspath())
def save(self): # Use rename to avoid corrupting the cache if interrupted tmp_fid = open(CACHE_FILE + ".tmp", "w") try: dump(self.cache, tmp_fid) finally: tmp_fid.close() rename(CACHE_FILE + ".tmp", CACHE_FILE)
def store(self): # Use rename to avoid corrupting the cache if interrupted tmp_fid = open(BUILD_CACHE + ".tmp", "wb") try: dump(self.cache, tmp_fid) finally: tmp_fid.close() rename(BUILD_CACHE + ".tmp", BUILD_CACHE)
def store(self, filename): tmp = filename + ".tmp" ensure_dir(tmp) fid = open(tmp, "w") try: for k in sorted(self.keys()): fid.write("%s = %r\n" % (k, self[k])) finally: fid.close() rename(tmp, filename)