mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 19:48:43 +08:00
Use `cythonize` instead of hard-coding Cython commands. Fixes #829.
This commit is contained in:
+2
-20
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user