# 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: util/Log.py
# class Log(object):
#     """
#     Log class
#     """
#     class __impl(object):
#         """ Implementation of singleton interface"""
#         def __init__(self):
#             """
#             """
#             self.levMap = {"ERROR":(0, "\033[31m%s%s\033[0m"), "WARNING":(1, "\033[33m%s%s\033[0m"), \
#                             "INFO":(2, "\033[34m%s%s\033[0m"), "MSG":(3, "\033[32m%s%s\033[0m"), \
#                             "UNKNOW":(4, "\033[31m%s%s\033[0m")}
#             self.config_level = 5
# 
#         def setLogLevel(self, lev):
#             """
#             Description : set log file level.The log message lower than this level will not be printed.
#             Args : lev : log level will be set.Value is [0-5],0 will not print any log message, 5 will print all log message
#             Return : NULL 
#             """
#             self.config_level = lev
# 
#         def LevPrint(self, level, msg, prefix=True):
#             """
#             Description :  print log message which has higher level than config level
#             Args: 
#                 level : ["ERROR", "WARNING", "INFO", "MSG", "UNKNOW"]
#                 msg : string, log message
#                 prefix : True , print time information
#                          False , don't print time information
#             Return : None
#             """
#             if level in self.levMap and self.levMap[level][0] > self.config_level:
#                 return 
# 
#             now = ""
#             pmsg = ""
#             if prefix:
#                 now = "[" + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) \
#                     + " " + str(threading.current_thread().ident) + "] "
#             if (level in self.levMap):
#                     pmsg = self.levMap[level][1] % (now, msg)
#             else:
#                     pmsg = "UNKNOW log level(%s)" % level 
#                     pmsg += self.levMap["UNKNOW"][1] % (now, msg)
#                 
#             print(pmsg)
#             sys.stdout.flush()
# 
#     
#     # class Log
#     __instance = None
#     def __init__(self):
#         """ Create singleton instance """
#         # Check whether we already have an instance
#         if Log.__instance is None:
#             # Create and remember instance
#             Log.__instance = Log.__impl()
# 
#         # Store instance reference as the only member in the handle
#         self.__dict__['_Log__instance'] = Log.__instance
# 
#     def __getattr__(self, attr):
#         """ Delegate access to implementation """
#         return getattr(self.__instance, attr)
# 
#     def __setattr__(self, attr, value):
#         """ Delegate access to implementation """
#         return setattr(self.__instance, attr, value)


import os
import sys
from util import Function
from util import Log
        if modify_time == self.modify_time:
            return False
        else:
            self.modify_time = modify_time
            ret = False
            # check hash
            _hash = Function.GetFileHash(self.pathname)
            if _hash != self.hash:
                self.hash = _hash
                # Log.Log().LevPrint('MSG', '%s content changed' % self.pathname)
                self.build = True
                ret = True
            return ret

    def IsModified(self):
        '''
        to check whether object self changed
        Returns:
            -1 : the file that cacahe representing is missing
            0 : not changed
            1 : changed
        '''
        if not os.path.exists(self.pathname):
            return -1

        # check mtime
        modify_time = None
        try:
            modify_time = os.stat(self.pathname).st_mtime
        except BaseException:

# 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: util/Log.py
# class Log(object):
#     """
#     Log class
#     """
#     class __impl(object):
#         """ Implementation of singleton interface"""
#         def __init__(self):
#             """
#             """
#             self.levMap = {"ERROR":(0, "\033[31m%s%s\033[0m"), "WARNING":(1, "\033[33m%s%s\033[0m"), \
#                             "INFO":(2, "\033[34m%s%s\033[0m"), "MSG":(3, "\033[32m%s%s\033[0m"), \
#                             "UNKNOW":(4, "\033[31m%s%s\033[0m")}
#             self.config_level = 5
# 
#         def setLogLevel(self, lev):
#             """
#             Description : set log file level.The log message lower than this level will not be printed.
#             Args : lev : log level will be set.Value is [0-5],0 will not print any log message, 5 will print all log message
#             Return : NULL 
#             """
#             self.config_level = lev
# 
#         def LevPrint(self, level, msg, prefix=True):
#             """
#             Description :  print log message which has higher level than config level
#             Args: 
#                 level : ["ERROR", "WARNING", "INFO", "MSG", "UNKNOW"]
#                 msg : string, log message
#                 prefix : True , print time information
#                          False , don't print time information
#             Return : None
#             """
#             if level in self.levMap and self.levMap[level][0] > self.config_level:
#                 return 
# 
#             now = ""
#             pmsg = ""
#             if prefix:
#                 now = "[" + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) \
#                     + " " + str(threading.current_thread().ident) + "] "
#             if (level in self.levMap):
#                     pmsg = self.levMap[level][1] % (now, msg)
#             else:
#                     pmsg = "UNKNOW log level(%s)" % level 
#                     pmsg += self.levMap["UNKNOW"][1] % (now, msg)
#                 
#             print(pmsg)
#             sys.stdout.flush()
# 
#     
#     # class Log
#     __instance = None
#     def __init__(self):
#         """ Create singleton instance """
#         # Check whether we already have an instance
#         if Log.__instance is None:
#             # Create and remember instance
#             Log.__instance = Log.__impl()
# 
#         # Store instance reference as the only member in the handle
#         self.__dict__['_Log__instance'] = Log.__instance
# 
#     def __getattr__(self, attr):
#         """ Delegate access to implementation """
#         return getattr(self.__instance, attr)
# 
#     def __setattr__(self, attr, value):
#         """ Delegate access to implementation """
#         return setattr(self.__instance, attr, value)


# Path: dependency/BrocObject.py
import os
import sys
from util import Function
from util import Log

        if modify_time == self.modify_time:
            return False
        else:
            self.modify_time = modify_time
            ret = False
            # check hash
            _hash = Function.GetFileHash(self.pathname)
            if _hash != self.hash:
                self.hash = _hash
                # Log.Log().LevPrint('MSG', '%s content changed' % self.pathname)
                self.build = True
                ret = True
            return ret

    def IsModified(self):
        '''
        to check whether object self changed
        Returns:
            -1 : the file that cacahe representing is missing
            0 : not changed
            1 : changed
        '''
        if not os.path.exists(self.pathname):
            return -1

        # check mtime
        modify_time = None
        try:
            modify_time = os.stat(self.pathname).st_mtime
        except BaseException:

            Log.Log().LevPrint('MSG', 'get %s modify_time failed' % self.pathname)