예제 #1
0
파일: cweb.py 프로젝트: dspinellis/rubber
def check(source, target, context):
    return prog_available('cweave')
예제 #2
0
파일: fig2dev.py 프로젝트: delcypher/rubber
def check (source, target, context):
	return prog_available('fig2dev')
예제 #3
0
def check(source, target, context):
    return prog_available('fig2dev')
예제 #4
0
def check(source, target, context):
    line = parse_line(context['command'], context)
    return prog_available(line[0])
예제 #5
0
def check(source, target, context):
    return prog_available('lhs2tex')
예제 #6
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
예제 #7
0
파일: shell.py 프로젝트: skapfer/rubber
def check (source, target, context):
	line = parse_line(context['command'], context)
	return prog_available(line[0])
예제 #8
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
예제 #9
0
파일: cweb.py 프로젝트: delcypher/rubber
def check (source, target, context):
	return prog_available('cweave')
예제 #10
0
def check(source, target, context):
    return prog_available('mpost')
예제 #11
0
파일: lhs2TeX.py 프로젝트: delcypher/rubber
def check (source, target, context):
	return prog_available('lhs2tex')