# Path: util/Function.py
# DIGITS = [str(x) for x in xrange(0, 10)] 
# ALPHABETS = []
# def CheckName(v):
# def DelFiles(path):
# def MoveFiles(src, dst):
# def Mkdir(target_dir):
# def CalcHash(data, method='MD5'):
# def GetFileHash(path, method='MD5'):
# def RunCommand(cmd, ignore_stderr_when_ok=False):
# def RunCommand_tty(cmd):


import os
import sys
import threading
import Queue
import cPickle
import Target
import BrocObject
from util import Function
        if not os.path.exists(self._cache_file):
            self._logger.LevPrint("MSG", "no broc cache and create a empty one")
            return 
        # try to load cache file
        self._logger.LevPrint("MSG", "loading cache(%s) ..." % self._cache_file)
        try:
            with open(self._cache_file, 'rb') as f:
                caches = cPickle.load(f)
                if caches[0] != self._version:
                    self._logger.LevPrint("MSG", "cache version(%s) no match system(%s)" 
                                          % (caches[0], self._version))
                else:
                    for cache in caches[1:]:
                        self._cache[cache.Pathname()] = cache
                        #self._logger.LevPrint("MSG", 'cache %s , %d hash is %s, build %s, Modified %s' % (cache.Pathname(), id(cache), cache.Hash(), cache.Build(), cache.Modified()))
        except BaseException as err:
            self._logger.LevPrint("MSG", "load broc cache(%s) faild(%s), create a empty cache"
                                 % (self._cache_file, str(err)))
        self._logger.LevPrint("MSG", "loading cache success")
        self._logger.LevPrint("MSG", "checking cache ...")
        self.SelfCheck()
        self._logger.LevPrint("MSG", "checking cache done")

    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)

# Path: util/Function.py
# DIGITS = [str(x) for x in xrange(0, 10)] 
# ALPHABETS = []
# def CheckName(v):
# def DelFiles(path):
# def MoveFiles(src, dst):
# def Mkdir(target_dir):
# def CalcHash(data, method='MD5'):
# def GetFileHash(path, method='MD5'):
# def RunCommand(cmd, ignore_stderr_when_ok=False):
# def RunCommand_tty(cmd):


# Path: dependency/BrocObjectMaster.py
import os
import sys
import threading
import Queue
import cPickle
import Target
import BrocObject
from util import Function

        if not os.path.exists(self._cache_file):
            self._logger.LevPrint("MSG", "no broc cache and create a empty one")
            return 
        # try to load cache file
        self._logger.LevPrint("MSG", "loading cache(%s) ..." % self._cache_file)
        try:
            with open(self._cache_file, 'rb') as f:
                caches = cPickle.load(f)
                if caches[0] != self._version:
                    self._logger.LevPrint("MSG", "cache version(%s) no match system(%s)" 
                                          % (caches[0], self._version))
                else:
                    for cache in caches[1:]:
                        self._cache[cache.Pathname()] = cache
                        #self._logger.LevPrint("MSG", 'cache %s , %d hash is %s, build %s, Modified %s' % (cache.Pathname(), id(cache), cache.Hash(), cache.Build(), cache.Modified()))
        except BaseException as err:
            self._logger.LevPrint("MSG", "load broc cache(%s) faild(%s), create a empty cache"
                                 % (self._cache_file, str(err)))
        self._logger.LevPrint("MSG", "loading cache success")
        self._logger.LevPrint("MSG", "checking cache ...")
        self.SelfCheck()
        self._logger.LevPrint("MSG", "checking cache done")

    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)