Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
 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
Exemple #4
0
 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
Exemple #5
0
 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)
Exemple #6
0
 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)
Exemple #7
0
 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
Exemple #8
0
 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)
Exemple #9
0
 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);
Exemple #10
0
 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
Exemple #11
0
 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)
Exemple #12
0
 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)
Exemple #13
0
 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)
Exemple #14
0
 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)
Exemple #15
0
 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
Exemple #16
0
 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