Commit 6f62c414 authored by Denis Bilenko's avatar Denis Bilenko

Merge pull request #504 from gevent/fix_cythonpp

cythonpp.py: fix breakage on newer cython versions
parents adb7b838 68b0afcb
......@@ -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)
......@@ -738,7 +743,7 @@ if __name__ == '__main__':
options, args = parser.parse_args()
if len(args) != 1:
sys.exit('Expected one argument, got %s' % len(args))
sys.exit('Expected one argument (filename), got %r' % args)
filename = args[0]
if options.debug:
......
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