From e3234b382f9384c45c101847c02860bdd6c673d2 Mon Sep 17 00:00:00 2001 From: Sergio Pascual Date: Mar 29 2016 22:24:00 +0000 Subject: New upstream (0.17.1) - Provide python2-scikit-learn - Add patch for numpy1.11 - New style macros --- diff --git a/python-scikit-learn.spec b/python-scikit-learn.spec index e055480..9cbd2a4 100644 --- a/python-scikit-learn.spec +++ b/python-scikit-learn.spec @@ -1,10 +1,18 @@ %global srcname scikit-learn -%global with_python3 1 +%global sum Machine learning in Python + +%global common_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. Name: python-scikit-learn Version: 0.17.1 -Release: 1%{?dist} -Summary: Machine learning in Python +Release: 2%{?dist} +Summary: %{sum} License: BSD URL: http://scikit-learn.org/ @@ -13,14 +21,10 @@ Source1: system-six.py Source2: system-joblib.py Patch0: sklearn-unbundle-joblib.patch Patch1: blas-name.patch +Patch2: sklean-np11.patch -BuildRequires: python2-devel -BuildRequires: numpy scipy python-nose python-matplotlib -BuildRequires: python-joblib >= 0.8.4 -BuildRequires: python-six >= 1.4.1 +BuildRequires: python2-devel python3-devel BuildRequires: atlas-devel blas-devel -BuildRequires: Cython python-pillow -Requires: numpy scipy python-joblib >= 0.8.4 %{?python_provide:%python_provide python-%{srcname}} @@ -28,30 +32,34 @@ Requires: numpy scipy python-joblib >= 0.8.4 %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. +%{common_description} + +%package -n python2-%{srcname} +Summary: %{sum} +BuildRequires: python2-devel python2-nose +BuildRequires: numpy scipy python2-matplotlib +BuildRequires: python2-joblib >= 0.9.4 +BuildRequires: python2-six >= 1.4.1 +BuildRequires: Cython python2-pillow +Requires: numpy +Requires: scipy +Requires: python2-joblib >= 0.9.4 + +%description -n python2-%{srcname} +%{common_description} -%if 0%{?with_python3} %package -n python3-%{srcname} -Summary: Machine learning in Python +Summary: %{sum} BuildRequires: python3-devel python3-nose BuildRequires: python3-numpy python3-scipy python3-matplotlib -BuildRequires: python3-joblib >= 0.8.4 +BuildRequires: python3-joblib >= 0.9.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 +Requires: python3-numpy python3-scipy python3-joblib >= 0.9.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 +%{common_description} %prep %autosetup -n %{srcname}-%{version} -p1 @@ -68,66 +76,46 @@ 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}|' +#chmod -x examples/decomposition/plot_pca_vs_fa_model_selection.py +#sed -i -e "1d" examples/decomposition/plot_pca_vs_fa_model_selection.py -%if 0%{?with_python3} -rm -rf %{py3dir} -cp -a . %{py3dir} -find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' -%endif # with_python3 +#find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|' %build -CFLAGS="%{optflags}" %{__python2} setup.py build - -%if 0%{?with_python3} -pushd %{py3dir} -CFLAGS="%{optflags}" %{__python3} setup.py build -popd -%endif # with_python3 +%py2_build +%py3_build %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 +%py2_install +%py3_install %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 +# nosetests-%{python2_version} -x sklearn popd -%files +%files -n python2-%{srcname} %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 - 0.17.1-1 +* Tue Mar 29 2016 Sergio Pascual - 0.17.1-2 - New upstream (0.17.1) - Provide python2-scikit-learn +- Add patch for numpy1.11 +- New style macros * Thu Feb 04 2016 Fedora Release Engineering - 0.17-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sklean-np11.patch b/sklean-np11.patch new file mode 100644 index 0000000..dc9d1e5 --- /dev/null +++ b/sklean-np11.patch @@ -0,0 +1,12 @@ +diff -ur scikit-learn-0.17.1/sklearn/feature_selection/univariate_selection.py scikit-learn-0.17.1.np11/sklearn/feature_selection/univariate_selection.py +--- scikit-learn-0.17.1/sklearn/feature_selection/univariate_selection.py 2016-02-18 19:00:45.000000000 +0100 ++++ scikit-learn-0.17.1.np11/sklearn/feature_selection/univariate_selection.py 2016-03-29 16:51:42.312649582 +0200 +@@ -403,7 +403,7 @@ + mask = scores > treshold + ties = np.where(scores == treshold)[0] + if len(ties): +- max_feats = len(scores) * self.percentile // 100 ++ max_feats = int(len(scores) * self.percentile / 100) + kept_ties = ties[:max_feats - mask.sum()] + mask[kept_ties] = True + return mask