Blob Blame History Raw
From 48be23fc5ca94efa0f42a2242f1bb10f11992a42 Mon Sep 17 00:00:00 2001
From: Orion Poplawski <orion@cora.nwra.com>
Date: Wed, 6 Apr 2016 10:33:26 -0600
Subject: [PATCH 1/3] Do not use setup_requires for cython - source tarballs
 have shipped .c files

---
 setup.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/setup.py b/setup.py
index 53b5aa7..1ca10a5 100644
--- a/setup.py
+++ b/setup.py
@@ -131,8 +131,6 @@ def configuration(parent_package='', top_path=None):
             'Operating System :: MacOS',
         ],
         install_requires=INSTALL_REQUIRES,
-        # install cython when running setup.py (source install)
-        setup_requires=['cython>=0.21'],
         requires=REQUIRES,
         packages=setuptools.find_packages(exclude=['doc']),
         include_package_data=True,

From b90d0b505ac9ae8f51b85058635c063b896566f6 Mon Sep 17 00:00:00 2001
From: Orion Poplawski <orion@cora.nwra.com>
Date: Wed, 6 Apr 2016 10:38:34 -0600
Subject: [PATCH 2/3] Simply do not use cython to rebuild .c files if installed
 cython is too old, do not emit error

Give RuntimeError if cython is missing and we need it
---
 skimage/_build.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/skimage/_build.py b/skimage/_build.py
index 2905ee2..e88d356 100644
--- a/skimage/_build.py
+++ b/skimage/_build.py
@@ -27,15 +27,19 @@ def cython(pyx_files, working_path=''):
     try:
         from Cython import __version__
         if LooseVersion(__version__) < '0.23':
-            raise RuntimeError('Cython >= 0.23 needed to build scikit-image')
+            raise ImportError
 
         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
-        print("Cython not found; falling back to pre-built %s" \
-              % " ".join([f.replace('.pyx.in', 'c').replace('.pyx', '.c')
-                          for f in pyx_files]))
+        # If cython is not found, the build will make use of
+        # the distributed .c files if present
+        c_files = [f.replace('.pyx.in', '.c').replace('.pyx', '.c') for f in pyx_files]
+        for cfile in [os.path.join(working_path, f) for f in c_files]:
+            if not os.path.isfile(cfile):
+                raise RuntimeError('Cython >= 0.23 is required to build scikit-image from SCM checkout')
+
+        print("Cython >= 0.23 not found; falling back to pre-built %s" \
+              % " ".join(c_files))
     else:
         for pyxfile in [os.path.join(working_path, f) for f in pyx_files]:
 

From db4f67ee6cc3f23442fd95597b20c63971bbb13f Mon Sep 17 00:00:00 2001
From: Orion Poplawski <orion@cora.nwra.com>
Date: Sat, 16 Apr 2016 15:10:54 -0600
Subject: [PATCH 3/3] SCM -> git

---
 skimage/_build.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/skimage/_build.py b/skimage/_build.py
index e88d356..b50128b 100644
--- a/skimage/_build.py
+++ b/skimage/_build.py
@@ -36,7 +36,7 @@ def cython(pyx_files, working_path=''):
         c_files = [f.replace('.pyx.in', '.c').replace('.pyx', '.c') for f in pyx_files]
         for cfile in [os.path.join(working_path, f) for f in c_files]:
             if not os.path.isfile(cfile):
-                raise RuntimeError('Cython >= 0.23 is required to build scikit-image from SCM checkout')
+                raise RuntimeError('Cython >= 0.23 is required to build scikit-image from git checkout')
 
         print("Cython >= 0.23 not found; falling back to pre-built %s" \
               % " ".join(c_files))