Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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);
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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