Commit 68b0afcb authored by Denis Bilenko's avatar Denis Bilenko

cythonpp.py: fix breakage on newer cython versions

Thanks to @zhangchunlin and @mvalkon.

Fix #483. Close #489.
parent e45f4b2b
......@@ -32,6 +32,11 @@ define_re = re.compile(r'^#define\s+([a-zA-Z_]\w*)(\((?:[^,)]+,)*[^,)]+\))?\s+(.
# Conditional directive:
condition_re = re.compile(r'^#(ifdef\s+.+|if\s+.+|else\s*|endif\s*)$')
# cython header:
cython_header_re = re.compile(r'^/\* (generated by cython [^\s*]+)[^*]+\*/$', re.I)
#assert cython_header_re.match('/* Generated by Cython 0.21.1 */').group(1) == 'Generated by Cython 0.21.1'
#assert cython_header_re.match('/* Generated by Cython 0.19 on 55-555-555 */').group(1) == 'Generated by Cython 0.19'
def match_condition(line):
line = line.strip()
......@@ -557,9 +562,9 @@ def postprocess_cython_output(filename, banner):
input = open(filename)
firstline = input.readline()
if firstline.strip().lower().startswith('/* generated by cython ') and firstline.strip().endswith('*/'):
line = firstline.strip().split(' on ', 1)[0]
result.append(line + ' */')
m = cython_header_re.match(firstline.strip())
if m:
result.append('/* %s */' % m.group(1))
else:
result.append(firstline)
......
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