From 82ff8ddf8c4c26ae12d8effb5fa8fb6c0399f358 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Sun, 24 Nov 2013 22:50:09 +0100 Subject: [PATCH 1/2] 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') From 5abc13d3e24f7d76e87a3637b89e8d52f428fbef Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Fri, 10 Jan 2014 13:45:40 +0100 Subject: [PATCH 2/2] Only require Cython if using a developer version --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) mode change 100644 => 100755 setup.py diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index 8c1ecb54..6a476c21 --- a/setup.py +++ b/setup.py @@ -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