Beispiel #1
0
 def getExplicitDependencies(self):
     filename = self.mrv.workPath + "/" + config.projectSubfolder + config.explicitDependenciesFilename
     if not os.path.exists(filename):
         return []
     f = open(filename, "r")
     lines = f.readlines()
     lines = [l.replace("\n", "") for l in lines]
     f.close()
     # Format of lines : [start1, start2, ...] -> [target1, target2, ...] -> command 
     dependencies = []
     for l in lines:
         sp = l.split("->")
         if len(sp) > 1:
             starts = sp[0]
             targets = sp[1]
             if "," in starts:
                 starts = starts.split(",")
             else:
                 starts = [starts]
             if "," in targets:
                 targets = targets.split(",")
             else:
                 targets = [targets]
         command = sp[2] if len(sp) == 3 else None
         starts = [tools.cleanFilename(x) for x in starts]
         targets = [tools.cleanFilename(x) for x in targets]
         dependencies.append(Dependency(starts = starts, targets = targets, command = command, printOutput = True))
     for dep in dependencies:
         fileStateOfStartFile = self.mrv.findFileState(self.mrv.workPath + "/" + dep.starts[0])
         dep.initialize(self.mrv, fileStateOfStartFile, pathIsRelativeToProject=True,explicit=True)
         self.addDependency(dep)
     return dependencies
 def readExplicitDependencies(self, lines):
     # Format of lines : [start1, start2, ...] -> [target1, target2, ...] -> command 
     dependencies = []
     for l in lines:
         sp = l.split(config.explicitFileSeparator)
         if len(sp) > 1:
             starts = sp[0]
             targets = sp[1]
             if "," in starts:
                 starts = starts.split(",")
             else:
                 starts = [starts]
             if "," in targets:
                 targets = targets.split(",")
             else:
                 targets = [targets]
         command = sp[2].strip() if len(sp) == 3 else None
         starts = [tools.cleanFilename(x) for x in starts]
         targets = [tools.cleanFilename(x) for x in targets]
         starts = self.findMatches(starts)
         targets = self.findMatches(targets)
         if starts == [] or targets == []:
             continue
         dependencies.append(Dependency(starts = starts, targets = targets, command = command, printOutput = True))
     return dependencies