Commit 29fca656 authored by Stefan Behnel's avatar Stefan Behnel

cythonrun: do not regenerate executable if it is already up-to-date

parent 1cab15b0
......@@ -91,13 +91,18 @@ def cycompile(input_file, options=()):
def exec_file(program_name, args=()):
runcmd([os.path.abspath(program_name)] + list(args), shell=False)
def build(input_file, compiler_args=()):
def build(input_file, compiler_args=(), force=False):
"""
Build an executable program from a Cython module.
Returns the name of the executable file.
"""
basename = os.path.splitext(input_file)[0]
exe_file = basename + EXE_EXT
if (not force and os.path.exists(exe_file) and os.path.exists(input_file)
and os.path.getmtime(input_file) <= os.path.getmtime(exe_file)):
_debug("File is up to date, not regenerating %s", exe_file)
return
cycompile(input_file, compiler_args)
ccompile(basename)
clink(basename)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment