Merge pull request #831 from astrofrog/use-cythonize

Use ``cythonize`` instead of hard-coding Cython commands
This commit is contained in:
Johannes Schönberger
2014-01-13 19:18:34 -08:00
2 changed files with 7 additions and 21 deletions
Regular → Executable
+5 -1
View File
@@ -21,10 +21,14 @@ VERSION = '0.10dev'
PYTHON_VERSION = (2, 5)
DEPENDENCIES = {
'numpy': (1, 6),
'Cython': (0, 17),
'six': (1, 3),
}
# Only require Cython if we have a developer checkout
if VERSION.endswith('dev'):
DEPENDENCIES['Cython'] = (0, 17)
import os
import sys
+2 -20
View File
@@ -3,7 +3,6 @@ import os
import hashlib
import subprocess
# WindowsError is not defined on unix systems
try:
WindowsError
@@ -26,7 +25,7 @@ def cython(pyx_files, working_path=''):
return
try:
import Cython
from Cython.Build import cythonize
except ImportError:
# If cython is not found, we do nothing -- the build will make use of
# the distributed .c files
@@ -39,24 +38,7 @@ def cython(pyx_files, working_path=''):
if not _changed(pyxfile):
continue
c_file = pyxfile[:-4] + '.c'
# run cython compiler
cmd = 'cython -o %s %s' % (c_file, pyxfile)
print(cmd)
try:
subprocess.call(['cython', '-o', c_file, pyxfile])
except WindowsError:
# On Windows cython.exe may be missing if Cython was installed
# via distutils. Run the cython.py script instead.
subprocess.call(
[sys.executable,
os.path.join(os.path.dirname(sys.executable),
'Scripts', 'cython.py'),
'-o', c_file, pyxfile],
shell=True)
cythonize(pyxfile)
def _md5sum(f):
m = hashlib.new('md5')