Blob Blame History Raw
%global srcname scikit-learn
%global with_python3 1

Name: python-scikit-learn
Version: 0.17.1
Release: 1%{?dist}
Summary: Machine learning in Python
License: BSD

URL: http://scikit-learn.org/
Source0: https://pypi.python.org/packages/source/s/scikit-learn/%{srcname}-%{version}.tar.gz
Source1: system-six.py
Source2: system-joblib.py
Patch0: sklearn-unbundle-joblib.patch
Patch1: blas-name.patch

BuildRequires: python2-devel 
BuildRequires: numpy scipy python-nose python-matplotlib
BuildRequires: python-joblib >= 0.8.4
BuildRequires: python-six >= 1.4.1
BuildRequires: atlas-devel blas-devel
BuildRequires: Cython python-pillow
Requires: numpy scipy python-joblib >= 0.8.4

%{?python_provide:%python_provide python-%{srcname}}

# we don't want to provide private python extension libs
%global __provides_exclude_from ^(%{python2_sitearch}|%{python3_sitearch})/.*\\.so$

%description
Scikit-learn integrates machine learning algorithms in the tightly-knit 
scientific Python world, building upon numpy, scipy, and matplotlib. 
As a machine-learning module, it provides versatile tools for data mining and 
analysis in any field of science and engineering. It strives to be simple and 
efficient, accessible to everybody, and reusable in various contexts.

%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: Machine learning in Python
BuildRequires: python3-devel python3-nose
BuildRequires: python3-numpy python3-scipy python3-matplotlib
BuildRequires: python3-joblib >= 0.8.4
BuildRequires: python3-six >= 1.4.1
BuildRequires: atlas-devel
BuildRequires: python3-Cython python3-pillow
Requires: python3-numpy python3-scipy python3-joblib >= 0.8.4

%description -n python3-%{srcname}
Scikit-learn integrates machine learning algorithms in the tightly-knit 
scientific Python world, building upon numpy, scipy, and matplotlib. 
As a machine-learning module, it provides versatile tools for data mining and 
analysis in any field of science and engineering. It strives to be simple and 
efficient, accessible to everybody, and reusable in various contexts.
%endif # with_python3

%prep
%autosetup -n %{srcname}-%{version} -p1

# Code to load system six and joblib at runtime
mkdir sklearn/externals/bundled
touch sklearn/externals/bundled/__init__.py
mv sklearn/externals/six.py sklearn/externals/bundled
mv sklearn/externals/joblib sklearn/externals/bundled
mv sklearn/externals/test_externals_setup.py sklearn/externals/bundled
cp %{SOURCE1} sklearn/externals/six.py
cp %{SOURCE2} sklearn/externals/joblib.py

# Remove the source code of the bundled blas library
rm -rf sklearn/src/cblas/*

chmod -x examples/decomposition/plot_pca_vs_fa_model_selection.py 
sed -i -e "1d" examples/decomposition/plot_pca_vs_fa_model_selection.py

find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3

%build
CFLAGS="%{optflags}" %{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="%{optflags}" %{__python3} setup.py build
popd
%endif # with_python3

%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%{__python2} setup.py install --skip-build --root %{buildroot}

find %{buildroot} -name "*.so" | xargs chmod 755

%check
%if 0%{?with_python3}
pushd %{buildroot}/%{python3_sitearch}
 nosetests-%{python3_version} -x sklearn
popd
%endif # with_python3

pushd %{buildroot}/%{python2_sitearch}
 nosetests-%{python2_version} -x sklearn
popd
 
%files
%doc examples/ AUTHORS.rst README.rst 
%license COPYING
%{python2_sitearch}/sklearn
%{python2_sitearch}/scikit_learn-*.egg-info

%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc examples/ AUTHORS.rst README.rst
%license COPYING
%{python3_sitearch}/sklearn
%{python3_sitearch}/scikit_learn-*.egg-info
%endif # with_python3

%changelog
* Tue Mar 29 2016 Sergio Pascual <sergiopr@fedoraproject.org> - 0.17.1-1
- New upstream (0.17.1)
- Provide python2-scikit-learn

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.17-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Nov 25 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.17-1
- Update to latest version
- Force linking to atlas

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.16.1-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.16.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Thu Apr 09 2015 Sergio Pascual <sergiopr@fedoraproject.org> - 0.16.1-1
- New upstream (0.16.1), bugfix

* Thu Apr 09 2015 Sergio Pascual <sergiopr@fedoraproject.org> - 0.16.0-2
- Readd provides filter
- Increase joblib minimum version
- New upstream (0.16.0)

* Tue Sep 16 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.15.2-2
- Remove patch for broken test (fixed in scipy 0.14.1)

* Tue Sep 16 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.15.2-1
- New upstream (0.15.2), bugfix

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.15.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Aug 02 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.15.1-1
- New upstream (0.15.1), bugfix

* Tue Jul 15 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.15.0-1
- New upstream (0.15.0), final

* Wed Jul 02 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.15.0-0.5.b2
- New upstream (0.15.0b2), beta release 

* Tue Jun 24 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.15.0-0.4.b1
- Add COPYING to docs
- Spec cleanup

* Mon Jun 23 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.15.0-0.3.b1
- New upstream (0.15.0b1), beta release 
- Add tarball
- Disable tests for the moment

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.14.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon Jun 02 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.14.1-8
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Mon Jun 02 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.14.1-7
- Rerun Cython3 on broken files
- Disable tests for the moment

* Thu May 29 2014 Björn Esser <bjoern.esser@gmail.com> - 0.14.1-6
- rebuilt for Python3 3.4

* Wed Jan 15 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.14.1-5
- Enable checks
- Regenerate C files from patched cython code
- Use python2 style macros

* Sat Oct 26 2013 Björn Esser <bjoern.esser@gmail.com> - 0.14.1-4
- rebuilt for atlas-3.10.1-7

* Mon Sep 16 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.14.1-3
- Unbundle six

* Wed Sep 11 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.14.1-2
- Update cblas patch
- Update EVR to build with new numpy (1.8.0-0.3b2)

* Wed Aug 28 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.14.1-1
- New upstream source (0.14.1)
- Add python3 support
- Unbundle joblib and cblas

* Wed Jul 10 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.13.1-3
- Reorder buildrequires and requires
- Dropped doc, it does not build

* Tue Jun 25 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.13.1-2
- Changed package name
- Tests do not need recompile

* Thu Apr 18 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.13.1-1
- Initial spec file