Remove Cython build requirement

- Only build python3 for Fedora
This commit is contained in:
Orion Poplawski 2016-08-16 09:34:09 -06:00
parent ecd6927e12
commit fde84b2a19
2 changed files with 105 additions and 3 deletions

88
2036.patch Normal file
View File

@ -0,0 +1,88 @@
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))

View File

@ -1,9 +1,13 @@
%if 0%{?fedora}
%global with_python3 1
%else
%global with_python3 0
%endif
%global srcname scikit-image
Name: python-scikit-image
Version: 0.12.3
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Image processing in Python
# The following files are BSD 2 clauses, the rest BSD 3 clauses
# skimage/graph/_mcp.pyx
@ -12,6 +16,8 @@ License: BSD
URL: http://scikit-image.org/
Source0: https://pypi.python.org/packages/source/s/scikit-image/scikit-image-%{version}.tar.gz
# Do not need Cython to build since upstream ships .pyx files
Patch0: https://patch-diff.githubusercontent.com/raw/scikit-image/scikit-image/pull/2036.patch
BuildRequires: xorg-x11-server-Xvfb
@ -21,8 +27,11 @@ versatile set of image processing routines.
%package -n python2-%{srcname}
Summary: Image processing in Python 2
BuildRequires: python2-devel python-setuptools numpy Cython
BuildRequires: python2-devel python-setuptools numpy
BuildRequires: scipy python-matplotlib python-nose
%if 0%{?rhel}
BuildRequires: python-matplotlib-qt4
%endif
BuildRequires: python-six >= 1.3
BuildRequires: python-networkx-core
BuildRequires: python-pillow
@ -39,7 +48,7 @@ versatile set of image processing routines.
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: Image processing in Python 3
BuildRequires: python3-devel python3-setuptools python3-numpy python3-Cython
BuildRequires: python3-devel python3-setuptools python3-numpy
BuildRequires: python3-scipy python3-matplotlib python3-nose
BuildRequires: python3-six >= 1.3
BuildRequires: python3-networkx-core
@ -70,6 +79,7 @@ Utilities provided by scikit-image: 'skivi'
%prep
%setup -n %{srcname}-%{version} -q
%patch0 -p1 -b .Cython
# Remove some shebangs
pushd skimage
for i in $(grep -l -r "/usr/bin/env"); do
@ -133,6 +143,10 @@ popd
%{_bindir}/skivi
%changelog
* Tue Aug 16 2016 Orion Poplawski <orion@cora.nwra.com> - 0.12.3-5
- Remove Cython build requirement
- Only build python3 for Fedora
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.12.3-4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages