targets/toolchain_gcc.py
changeset 427 7ac746c07ff2
parent 421 c9ec111ad275
child 510 8038c08b9874
equal deleted inserted replaced
426:3f285782ac9b 427:7ac746c07ff2
    10     It cannot be used as this and should be inherited in a target specific
    10     It cannot be used as this and should be inherited in a target specific
    11     class such as target_linux or target_win32
    11     class such as target_linux or target_win32
    12     """
    12     """
    13     def __init__(self, PluginsRootInstance):
    13     def __init__(self, PluginsRootInstance):
    14         self.PluginsRootInstance = PluginsRootInstance
    14         self.PluginsRootInstance = PluginsRootInstance
    15         self.exe = PluginsRootInstance.GetProjectName() + self.extension
    15         self.buildpath = None
    16         self.buildpath = PluginsRootInstance._getBuildPath()
    16         self.SetBuildPath(self.PluginsRootInstance._getBuildPath())
    17         self.exe_path = os.path.join(self.buildpath, self.exe)
       
    18         self.md5key = None
       
    19         self.srcmd5 = {}
       
    20 
    17 
    21     def getTarget(self):
    18     def getTarget(self):
    22         target = self.PluginsRootInstance.BeremizRoot.getTargetType()
    19         target = self.PluginsRootInstance.BeremizRoot.getTargetType()
    23         if target.getcontent() is None:
    20         if target.getcontent() is None:
    24             target = self.PluginsRootInstance.GetDefaultTarget()
    21             target = self.PluginsRootInstance.GetDefaultTarget()
    52         else:
    49         else:
    53             try:
    50             try:
    54                 return open(self._GetMD5FileName(), "r").read()
    51                 return open(self._GetMD5FileName(), "r").read()
    55             except Exception, e:
    52             except Exception, e:
    56                 return None
    53                 return None
    57 
    54     
       
    55     def SetBuildPath(self, buildpath):
       
    56         if self.buildpath != buildpath:
       
    57             self.buildpath = buildpath
       
    58             self.exe = self.PluginsRootInstance.GetProjectName() + self.extension
       
    59             self.exe_path = os.path.join(self.buildpath, self.exe)
       
    60             self.md5key = None
       
    61             self.srcmd5 = {}
       
    62     
    58     def check_and_update_hash_and_deps(self, bn):
    63     def check_and_update_hash_and_deps(self, bn):
    59         # Get latest computed hash and deps
    64         # Get latest computed hash and deps
    60         oldhash, deps = self.srcmd5.get(bn,(None,[]))
    65         oldhash, deps = self.srcmd5.get(bn,(None,[]))
    61         # read source
    66         # read source
    62         src = open(os.path.join(self.buildpath, bn)).read()
    67         src = open(os.path.join(self.buildpath, bn)).read()