コード例 #1
0
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):
        ic = InteractiveConsole()
        path = args["path"].value().path
        print "executing batch script " + path
        file = open(path)
        for line in file.xreadlines():
            if line[0] == "#":
                continue
            elif line[0] == "!":
                cmds = self.lp.makeCommands(line[1:])
                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()
            else:
                ic.push(line)
        ic.resetbuffer()
        file.close()
        return
コード例 #2
0
ファイル: batch.py プロジェクト: udgover/modules
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):
    ic = InteractiveConsole()
    path = args["path"].value().path
    print "executing batch script " + path 
    file = open(path) 
    for line in file.xreadlines():
	if line[0] == "#":
	   continue
        elif line[0] == "!":
	  cmds = self.lp.makeCommands(line[1:])
	  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()
	else:
	   ic.push(line) 
    ic.resetbuffer()
    file.close()
    return
コード例 #3
0
ファイル: batch.py プロジェクト: vertrex/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
        ib = InteractiveBatch(path)
        ifile = open(path)
        ifeed = False
        err = None
        for line in ifile.xreadlines():
            lstrip = line.strip()
            if lstrip.startswith("!"):
                if ifeed:
                    ifeed = ib.lpush("")
                cmds = self.lp.makeCommands(line[1:])
                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()
            else:
                try:
                    ifeed = ib.lpush(line)
                except RuntimeError:
                    ifeed = False
                    break
            ib.lcount += 1
        ib.end()
        ifile.close()
        return