Fix Cython build on Windows [patch by Christoph Gohlke].

This commit is contained in:
Stefan van der Walt
2011-01-28 15:38:43 +02:00
parent 8db2b73c32
commit 84781fc987
+12 -3
View File
@@ -28,8 +28,17 @@ def cython(pyx_files, working_path=''):
# run cython compiler
cmd = 'cython -o %s %s' % (c_file_new, pyxfile)
print cmd
status = subprocess.call(['cython', '-o', c_file_new, pyxfile],
shell=(platform.system() == 'Windows'))
if platform.system() == 'Windows':
status = subprocess.call(
[sys.executable,
os.path.join(os.path.dirname(sys.executable),
'Scripts', 'cython.py'),
'-o', c_file_new, pyxfile],
shell=True)
else:
status = subprocess.call(['cython', '-o', c_file_new, pyxfile])
# if the resulting file is small, cython compilation failed
if status != 0 or os.path.getsize(c_file_new) < 100:
print "Cython compilation of %s failed. Falling back " \
@@ -39,7 +48,7 @@ def cython(pyx_files, working_path=''):
# use that one instead
shutil.copy(c_file_new, c_file)
os.remove(c_file_new)
def same_cython(f0, f1):
'''Compare two Cython generated C-files, based on their md5-sum.