def __addCmdStdio(self, fspecs, specSet, exclude=None): "add None, a single or a list of file specs as requires or produces links" for fspec in typeOps.mkiter(fspecs): if (isinstance(fspec, FileIn) or isinstance(fspec, FileOut)): fspec = fspec.file # get File object for reference if (isinstance(fspec, File) and ((exclude == None) or (fspec not in exclude))): specSet.add(fspec)
def linkRequires(self, requires): """link in productions or targets required by this node. Can be single nodes, or lists or sets of nodes""" for r in typeOps.mkiter(requires): if not (isinstance(r, Production) or isinstance(r, Target)): raise ExRunException("Target " + str(self) + " requires can only be linked to a Production or a Target, attempt to link to: " + str(r)) self.requires.add(r)
def __specsToStateTbl(self, notOkSpecs): "convert spec lists no tables" notOkStates = {} for spec in notOkSpecs: for n in typeOps.mkiter(spec[0]): notOkStates[n] = spec[1] return notOkStates
def __specsToStateTbl(self, notOkSpecs): "convert spec lists no tables" notOkStates = {} for spec in notOkSpecs: for n in typeOps.mkiter(spec[0]): notOkStates[n] = spec[1] return notOkStates
def linkProduces(self, produces): """link in productions produced by this node. Can be single nodes, or lists or sets of nodes, reverse links are created""" for p in typeOps.mkiter(produces): if not isinstance(p, Production): raise ExRunException("Rule " + str(self) + " produces can only be linked to a Production, attempt to link to: " + str(p)) p.linkProducedBy(self)
def linkRequires(self, requires): """link in productions required by this node. Can be single nodes, or lists or sets of nodes, reverse links are created""" for r in typeOps.mkiter(requires): if not isinstance(r, Production): raise ExRunException("Rule " + str(self) + " requires can only be linked to a Production, attempt to link to: " + str(r)) r.linkRequiredBy(self)
def getFiles(self, paths): """like getFile(), only path can be a single path, or a list of paths, or a File object, or list of File objects. Returns a list of File objects""" files = [] for p in typeOps.mkiter(paths): files.append(self.getFile(p)) return files
def __addCmdStdio(self, fspecs, specSet, exclude=None): "add None, a single or a list of file specs as requires or produces links" for fspec in typeOps.mkiter(fspecs): if (isinstance(fspec, FileIn) or isinstance(fspec, FileOut)): fspec = fspec.file # get File object for reference if (isinstance(fspec, File) and ((exclude == None) or (fspec not in exclude))): specSet.add(fspec)
def linkRequiredBy(self, requiredBy): """link to rules that require production, can be single rule, lists or sets of rules, reverse links are created""" for r in typeOps.mkiter(requiredBy): if not isinstance(r, Rule): raise ExRunException("Production " + str(self) + " requiredBy can only be linked to a Rule, attempt to link to: " + str(r)) self.requiredBy.add(r) r.requires.add(self);
def getFiles(self, paths): """like getFile(), only path can be a single path, or a list of paths, or a File object, or list of File objects. Returns a list of File objects""" files = [] for p in typeOps.mkiter(paths): files.append(self.getFile(p)) return files
def linkRequires(self, requires): """link in productions or targets required by this node. Can be single nodes, or lists or sets of nodes""" for r in typeOps.mkiter(requires): if not (isinstance(r, Production) or isinstance(r, Target)): raise ExRunException( "Target " + str(self) + " requires can only be linked to a Production or a Target, attempt to link to: " + str(r)) self.requires.add(r)
def linkProduces(self, produces): """link in productions produced by this node. Can be single nodes, or lists or sets of nodes, reverse links are created""" for p in typeOps.mkiter(produces): if not isinstance(p, Production): raise ExRunException( "Rule " + str(self) + " produces can only be linked to a Production, attempt to link to: " + str(p)) p.linkProducedBy(self)
def linkRequires(self, requires): """link in productions required by this node. Can be single nodes, or lists or sets of nodes, reverse links are created""" for r in typeOps.mkiter(requires): if not isinstance(r, Production): raise ExRunException( "Rule " + str(self) + " requires can only be linked to a Production, attempt to link to: " + str(r)) r.linkRequiredBy(self)
def linkRequiredBy(self, requiredBy): """link to rules that require production, can be single rule, lists or sets of rules, reverse links are created""" for r in typeOps.mkiter(requiredBy): if not isinstance(r, Rule): raise ExRunException( "Production " + str(self) + " requiredBy can only be linked to a Rule, attempt to link to: " + str(r)) self.requiredBy.add(r) r.requires.add(self)
def __getRunTargets(self, targets=None): "get list of targets to run, return the default if none specified" ts = [] for t in typeOps.mkiter(targets): if isinstance(t, Target): ts.append(t) else: ts.append(self.getTarget(t)) if len(ts) == 0: ts.append(self.getTarget(self.defaultTargetName)) return ts
def __getRunTargets(self, targets=None): "get list of targets to run, return the default if none specified" ts = [] for t in typeOps.mkiter(targets): if isinstance(t, Target): ts.append(t) else: ts.append(self.getTarget(t)) if len(ts) == 0: ts.append(self.getTarget(self.defaultTargetName)) return ts