Commit 5f3bd808 authored by Denis Bilenko's avatar Denis Bilenko

cythonpp.py: print configuration even if the result is reused

parent 0ab34480
...@@ -87,8 +87,10 @@ def process_filename(filename, output_filename=None): ...@@ -87,8 +87,10 @@ def process_filename(filename, output_filename=None):
atomic_write(output_filename + '.%s' % counter, output) atomic_write(output_filename + '.%s' % counter, output)
sources.append(attach_tags(output, configuration)) sources.append(attach_tags(output, configuration))
log('Generating %s', output_filename) sys.stderr.write('Generating %s ' % output_filename)
generate_merged(output_filename, sources) result = generate_merged(output_filename, sources)
atomic_write(output_filename, result)
sys.stderr.write('%s bytes\n' % len(result))
if filename != pyx_filename: if filename != pyx_filename:
log('Saving %s', pyx_filename) log('Saving %s', pyx_filename)
...@@ -99,7 +101,7 @@ def generate_merged(output_filename, sources): ...@@ -99,7 +101,7 @@ def generate_merged(output_filename, sources):
result = [] result = []
for line in produce_preprocessor(merge(sources)): for line in produce_preprocessor(merge(sources)):
result.append(line.replace(newline_token, '\n')) result.append(line.replace(newline_token, '\n'))
atomic_write(output_filename, ''.join(result)) return ''.join(result)
def preprocess_filename(filename, config): def preprocess_filename(filename, config):
...@@ -520,9 +522,11 @@ def atomic_write(filename, data): ...@@ -520,9 +522,11 @@ def atomic_write(filename, data):
def run_cython(filename, sourcehash, output_filename, banner, comment, cache={}): def run_cython(filename, sourcehash, output_filename, banner, comment, cache={}):
result = cache.get(sourcehash) result = cache.get(sourcehash)
command = '%s -o %s %s' % (CYTHON, pipes.quote(output_filename), pipes.quote(filename))
if result is not None: if result is not None:
log('Reusing %s # %s', command, comment)
return result return result
system('%s -o %s %s' % (CYTHON, pipes.quote(output_filename), pipes.quote(filename)), comment) system(command, comment)
result = postprocess_cython_output(output_filename, banner) result = postprocess_cython_output(output_filename, banner)
cache[sourcehash] = result cache[sourcehash] = result
return result return result
......
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