示例#1
0
文件: batch.py 项目: halbbob/dff
 def __init__(self):
   Script.__init__(self, "batch")
   self.tm = TaskManager()
   self.DEBUG = False
   self.VERBOSITY = 0
   self.lp = LineParser(self.DEBUG, self.VERBOSITY -1)
   self.cm = ConfigManager.Get()
示例#2
0
文件: batch.py 项目: halbbob/dff
class BATCH(Script):
  def __init__(self):
    Script.__init__(self, "batch")
    self.tm = TaskManager()
    self.DEBUG = False
    self.VERBOSITY = 0
    self.lp = LineParser(self.DEBUG, self.VERBOSITY -1)
    self.cm = ConfigManager.Get()

  def start(self, args):
    path = args["path"].value().path
    print "executing batch script " + path 
    file = open(path) 
    for line in file.xreadlines():
	if line[0] == "#":
	   print line[1:]
        else:
	  cmds = self.lp.makeCommands(line)
	  for cmd in cmds:
	    exec_type = ["console"]
	    config = self.cm.configByName(cmd[0])
	    args  = config.generate(cmd[1])
	    proc = self.tm.add(cmd[0], args, exec_type)
	    proc.event.wait()
    file.close()
    return