コード例 #1
0
def make(loc, args):
    """Invoke the ``make`` command from within ``loc`` with arguments ``args``."""
    hash_key = sha1((loc + str(args)).encode()).hexdigest()
    logfile = path.join(get_jit_dir(), "%s.log" % hash_key)
    errfile = path.join(get_jit_dir(), "%s.err" % hash_key)

    tic = time()
    with change_directory(loc):
        with open(logfile, "w") as lf:
            with open(errfile, "w") as ef:

                command = ['make'] + args
                lf.write("Compilation command:\n")
                lf.write(" ".join(command))
                lf.write("\n\n")
                try:
                    check_call(command, stderr=ef, stdout=lf)
                except CalledProcessError as e:
                    raise CompilationError(
                        'Command "%s" return error status %d. '
                        'Unable to compile code.\n'
                        'Compile log in %s\n'
                        'Compile errors in %s\n' %
                        (e.cmd, e.returncode, logfile, errfile))
    toc = time()
    debug("Make <%s>: run in [%.2f s]" % (" ".join(args), toc - tic))
コード例 #2
0
def make(loc, args):
    """
    Invoke ``make`` command from within ``loc`` with arguments ``args``.
    """
    hash_key = sha1((loc + str(args)).encode()).hexdigest()
    logfile = path.join(get_tmp_dir(), "%s.log" % hash_key)
    errfile = path.join(get_tmp_dir(), "%s.err" % hash_key)

    with change_directory(loc):
        with open(logfile, "w") as log:
            with open(errfile, "w") as err:

                command = ['make'] + args
                log.write("Compilation command:\n")
                log.write(" ".join(command))
                log.write("\n\n")
                try:
                    subprocess.check_call(command, stderr=err, stdout=log)
                except subprocess.CalledProcessError as e:
                    raise CompilationError('Command "%s" return error status %d. '
                                           'Unable to compile code.\n'
                                           'Compile log in %s\n'
                                           'Compile errors in %s\n' %
                                           (e.cmd, e.returncode, logfile, errfile))