Commit 8fd32a78 authored by Denis Bilenko's avatar Denis Bilenko

setup.py: run cython if core.c does not exist

parent 75c24b62
...@@ -40,12 +40,16 @@ class my_build_ext(build_ext.build_ext): ...@@ -40,12 +40,16 @@ class my_build_ext(build_ext.build_ext):
def compile_cython(self): def compile_cython(self):
sources = glob.glob('gevent/*.pyx') + sorted(glob.glob('gevent/*.pxi')) sources = glob.glob('gevent/*.pyx') + sorted(glob.glob('gevent/*.pxi'))
if not sources: if not sources:
print >> sys.stderr, 'Could not find gevent.core sources' if not os.path.exists('gevent/core.c'):
return print >> sys.stderr, 'Could not find gevent/core.c'
if os.path.exists('gevent/core.c'):
core_c_mtime = os.stat('gevent/core.c').st_mtime core_c_mtime = os.stat('gevent/core.c').st_mtime
changed = [filename for filename in sources if (os.stat(filename).st_mtime - core_c_mtime) > 1] changed = [filename for filename in sources if (os.stat(filename).st_mtime - core_c_mtime) > 1]
if changed: if not changed:
return
print >> sys.stderr, 'Running cython (changed: %s)' % ', '.join(changed) print >> sys.stderr, 'Running cython (changed: %s)' % ', '.join(changed)
else:
print >> sys.stderr, 'Running cython'
cython_result = os.system('cython gevent/core.pyx') cython_result = os.system('cython gevent/core.pyx')
if cython_result: if cython_result:
if os.system('cython -V 2> %s' % os.devnull): if os.system('cython -V 2> %s' % os.devnull):
......
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