def check(source, target, context): return prog_available('cweave')
def check (source, target, context): return prog_available('fig2dev')
def check(source, target, context): return prog_available('fig2dev')
def check(source, target, context): line = parse_line(context['command'], context) return prog_available(line[0])
def check(source, target, context): return prog_available('lhs2tex')
def execute(self, prog, env={}, pwd=None, out=None, kpse=0): """ Silently execute an external program. The `prog' argument is the list of arguments for the program, `prog[0]' is the program name. The `env' argument is a dictionary with definitions that should be added to the environment when running the program. The standard output is passed line by line to the `out' function (or discarded by default). If the optional argument `kpse' is true, the error output is parsed and messages from Kpathsea are processed (to indicate e.g. font compilation), otherwise the error output is kept untouched. """ msg.info(_("executing: %s") % " ".join(prog)) if pwd: msg.log(_(" in directory %s") % pwd) if env != {}: msg.log(_(" with environment: %r") % env) progname = prog_available(prog[0]) if not progname: msg.error(_("%s not found") % prog[0]) return 1 penv = os.environ.copy() for (key, val) in env.items(): penv[key] = val if kpse: stderr = subprocess.PIPE else: stderr = None process = Popen(prog, executable=progname, env=penv, cwd=pwd, stdin=devnull(), stdout=subprocess.PIPE, stderr=stderr) if kpse: def parse_kpse(): for line in process.stderr.readlines(): line = line.rstrip() match = re_kpse.match(line) if not match: continue cmd = match.group("cmd") if self.kpse_msg.has_key(cmd): msg.progress(match.expand(self.kpse_msg[cmd])) else: msg.progress(_("kpathsea running %s") % cmd) t = threading.Thread(target=parse_kpse) t.start() #thread.start_new_thread(parse_kpse, ()) if out is not None: for line in process.stdout.readlines(): out(line) else: process.stdout.readlines() ret = process.wait() msg.log(_("process %d (%s) returned %d") % (process.pid, prog[0], ret)) return ret
def check (source, target, context): line = parse_line(context['command'], context) return prog_available(line[0])
def execute (self, prog, env={}, pwd=None, out=None, kpse=0): """ Silently execute an external program. The `prog' argument is the list of arguments for the program, `prog[0]' is the program name. The `env' argument is a dictionary with definitions that should be added to the environment when running the program. The standard output is passed line by line to the `out' function (or discarded by default). If the optional argument `kpse' is true, the error output is parsed and messages from Kpathsea are processed (to indicate e.g. font compilation), otherwise the error output is kept untouched. """ msg.info(_("executing: %s") % " ".join(prog)) if pwd: msg.log(_(" in directory %s") % pwd) if env != {}: msg.log(_(" with environment: %r") % env) progname = prog_available(prog[0]) if not progname: msg.error(_("%s not found") % prog[0]) return 1 penv = os.environ.copy() for (key,val) in env.items(): penv[key] = val if kpse: stderr = subprocess.PIPE else: stderr = None process = Popen(prog, executable = progname, env = penv, cwd = pwd, stdin = devnull(), stdout = subprocess.PIPE, stderr = stderr) if kpse: def parse_kpse (): for line in process.stderr.readlines(): line = line.rstrip() match = re_kpse.match(line) if not match: continue cmd = match.group("cmd") if self.kpse_msg.has_key(cmd): msg.progress(match.expand(self.kpse_msg[cmd])) else: msg.progress(_("kpathsea running %s") % cmd) t = threading.Thread(target=parse_kpse) t.start() #thread.start_new_thread(parse_kpse, ()) if out is not None: for line in process.stdout.readlines(): out(line) else: process.stdout.readlines() ret = process.wait() msg.log(_("process %d (%s) returned %d") % (process.pid, prog[0],ret)) return ret
def check (source, target, context): return prog_available('cweave')
def check(source, target, context): return prog_available('mpost')
def check (source, target, context): return prog_available('lhs2tex')