示例#1
0
 def Dump(self):
     """
     save dependency relation of files
     """
     dumped_file = os.path.join(self._root, ".BROC.FILE.DEPS")
     for pathname in self._cache:
         # the length of reverse deps is 0 means it is application or libs of main module
         if len(self._cache[pathname].reverse_deps) <= 0:
             self._dump(pathname, 0)
     try:
         dir_name = os.path.dirname(dumped_file)
         Function.Mkdir(dir_name)
         with open(dumped_file, "w") as f:
             f.write("" + self._dumped_str)
     except IOError as err:
         self._logger.LevPrint("ERROR",
                               "save file dependency failed(%s)" % err)
示例#2
0
 def _save_cache(self):
     """
     save cache objects into file
     and content of file is a list and its format is [ version, cache, cache, ...].
     the first item is cache version, and the 2th, 3th ... item is cache object
     """
     dir_name = os.path.dirname(self._cache_file)
     Function.Mkdir(dir_name)
     try:
         caches = [self._version]
         caches.extend(map(lambda x: self._cache[x], self._cache))
         with open(self._cache_file, 'wb') as f:
             cPickle.dump(caches, f)
     except Exception as err:
         self._logger.LevPrint(
             "ERROR",
             "save cache(%s) failed(%s)" % (self._cache_file, str(err)))