# 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
            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)))

    def _dump(self, pathname, level):
        """
        dump dependecy relationship into file, DFS
        """
        if self._cache[pathname].build is True:
            infos = "\t" * level + "[" + pathname + "]\n"          #need to build
        else:
            infos = "\t" * level + pathname + "\n"
        self._dumped_str += infos
        for deps_pathname in self._cache[pathname].deps:
            self._dump(deps_pathname.Pathname(), level + 1)

    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)

# 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

            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)))

    def _dump(self, pathname, level):
        """
        dump dependecy relationship into file, DFS
        """
        if self._cache[pathname].build is True:
            infos = "\t" * level + "[" + pathname + "]\n"          #need to build
        else:
            infos = "\t" * level + pathname + "\n"
        self._dumped_str += infos
        for deps_pathname in self._cache[pathname].deps:
            self._dump(deps_pathname.Pathname(), level + 1)

    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)