From 82ff8ddf8c4c26ae12d8effb5fa8fb6c0399f358 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Sun, 24 Nov 2013 22:50:09 +0100 Subject: [PATCH] Use ``cythonize`` instead of hard-coding Cython commands. Fixes #829. --- skimage/_build.py | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/skimage/_build.py b/skimage/_build.py index 38239e4b..862117ed 100644 --- a/skimage/_build.py +++ b/skimage/_build.py @@ -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')