Sergio Pascual c40d0b7
%global upname scikit-learn
Sergio Pascual 84acc60
%global with_python3 1
Sergio Pascual c40d0b7
Sergio Pascual c40d0b7
Name: python-scikit-learn
Sergio Pascual 3bd41f7
Version: 0.14.1
Sergio Pascual 3bd41f7
Release: 1%{?dist}
Sergio Pascual c40d0b7
Summary: Machine learning in Python
Sergio Pascual c40d0b7
License: BSD
Sergio Pascual c40d0b7
# No license file
Sergio Pascual 3bd41f7
# https://github.com/scikit-learn/scikit-learn/issues/2422
Sergio Pascual c40d0b7
# webpage says: BSD (3 clause)
Sergio Pascual 3bd41f7
Sergio Pascual c40d0b7
URL: http://scikit-learn.org/
Sergio Pascual c40d0b7
Source0: https://pypi.python.org/packages/source/s/scikit-learn/%{upname}-%{version}.tar.gz
Sergio Pascual 3bd41f7
Patch0: sklearn-unbundle-joblib.patch
Sergio Pascual 18ed09a
Patch1: sklearn-unbundle-cblas.patch
Sergio Pascual c40d0b7
BuildRequires: python2-devel 
Sergio Pascual 3bd41f7
BuildRequires: numpy scipy python-nose python-matplotlib
Sergio Pascual 84acc60
BuildRequires: python-joblib
Sergio Pascual 3bd41f7
BuildRequires: atlas-devel blas-devel
Sergio Pascual 84acc60
Requires: numpy scipy python-joblib
Sergio Pascual c40d0b7
Sergio Pascual c40d0b7
# we don't want to provide private python extension libs
Sergio Pascual 3bd41f7
%global __provides_exclude_from ^(%{python_sitearch}|%{python3_sitearch})/.*\\.so$
Sergio Pascual c40d0b7
Sergio Pascual c40d0b7
%description
Sergio Pascual c40d0b7
Scikit-learn integrates machine learning algorithms in the tightly-knit 
Sergio Pascual c40d0b7
scientific Python world, building upon numpy, scipy, and matplotlib. 
Sergio Pascual c40d0b7
As a machine-learning module, it provides versatile tools for data mining and 
Sergio Pascual c40d0b7
analysis in any field of science and engineering. It strives to be simple and 
Sergio Pascual c40d0b7
efficient, accessible to everybody, and reusable in various contexts.
Sergio Pascual c40d0b7
Sergio Pascual 3bd41f7
%if 0%{?with_python3}
Sergio Pascual 3bd41f7
%package -n python3-%{upname}
Sergio Pascual 3bd41f7
Summary: Machine learning in Python
Sergio Pascual 3bd41f7
BuildRequires: python3-devel python3-nose
Sergio Pascual 3bd41f7
BuildRequires: python3-numpy python3-scipy python3-matplotlib
Sergio Pascual 84acc60
BuildRequires: python3-joblib
Sergio Pascual 3bd41f7
BuildRequires: atlas-devel blas-devel
Sergio Pascual 3bd41f7
Requires: python3-numpy python3-scipy
Sergio Pascual 3bd41f7
Sergio Pascual 3bd41f7
%description -n python3-%{upname}
Sergio Pascual 3bd41f7
Scikit-learn integrates machine learning algorithms in the tightly-knit 
Sergio Pascual 3bd41f7
scientific Python world, building upon numpy, scipy, and matplotlib. 
Sergio Pascual 3bd41f7
As a machine-learning module, it provides versatile tools for data mining and 
Sergio Pascual 3bd41f7
analysis in any field of science and engineering. It strives to be simple and 
Sergio Pascual 3bd41f7
efficient, accessible to everybody, and reusable in various contexts.
Sergio Pascual 3bd41f7
%endif # with_python3
Sergio Pascual 3bd41f7
Sergio Pascual c40d0b7
%prep
Sergio Pascual c40d0b7
%setup -n %{upname}-%{version} -q
Sergio Pascual 3bd41f7
%patch0 -p1
Sergio Pascual 18ed09a
%patch1 -p1
Sergio Pascual 18ed09a
Sergio Pascual 3bd41f7
rm -rf sklearn/externals/joblib
Sergio Pascual 18ed09a
rm -rf sklearn/src/cblas
Sergio Pascual c40d0b7
rm -rf *egg-info
Sergio Pascual c40d0b7
Sergio Pascual 3bd41f7
chmod -x examples/plot_rbm_logistic_classification.py
Sergio Pascual 3bd41f7
Sergio Pascual 3bd41f7
# Reported upstream
Sergio Pascual 3bd41f7
# https://github.com/scikit-learn/scikit-learn/issues/2423
Sergio Pascual c40d0b7
# Removing bogus shebang
Sergio Pascual c40d0b7
pushd sklearn/datasets
Sergio Pascual c40d0b7
sed -i -e "1d" setup.py
Sergio Pascual c40d0b7
popd
Sergio Pascual c40d0b7
Sergio Pascual c40d0b7
pushd sklearn/gaussian_process/
Sergio Pascual 3bd41f7
#sed -i -e "1d" gaussian_process.py regression_models.py __init__.py correlation_models.py
Sergio Pascual 3bd41f7
sed -i -e "1d" regression_models.py __init__.py correlation_models.py
Sergio Pascual 3bd41f7
sed -i -e "2d" gaussian_process.py 
Sergio Pascual c40d0b7
popd
Sergio Pascual c40d0b7
Sergio Pascual 3bd41f7
%if 0%{?with_python3}
Sergio Pascual 3bd41f7
rm -rf %{py3dir}
Sergio Pascual 3bd41f7
cp -a . %{py3dir}
Sergio Pascual 3bd41f7
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
Sergio Pascual 3bd41f7
%endif # with_python3
Sergio Pascual 3bd41f7
Sergio Pascual 3bd41f7
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'
Sergio Pascual 3bd41f7
Sergio Pascual c40d0b7
%build
Sergio Pascual c40d0b7
CFLAGS="%{optflags}" %{__python} setup.py build
Sergio Pascual c40d0b7
Sergio Pascual 3bd41f7
%if 0%{?with_python3}
Sergio Pascual 3bd41f7
pushd %{py3dir}
Sergio Pascual 3bd41f7
CFLAGS="%{optflags}" %{__python3} setup.py build
Sergio Pascual 3bd41f7
popd
Sergio Pascual 3bd41f7
%endif # with_python3
Sergio Pascual 3bd41f7
Sergio Pascual c40d0b7
%install
Sergio Pascual 3bd41f7
%if 0%{?with_python3}
Sergio Pascual 3bd41f7
pushd %{py3dir}
Sergio Pascual 3bd41f7
%{__python3} setup.py install --skip-build --root  %{buildroot}
Sergio Pascual 3bd41f7
popd
Sergio Pascual 3bd41f7
%endif # with_python3
Sergio Pascual 3bd41f7
Sergio Pascual c40d0b7
%{__python} setup.py install --skip-build --root  %{buildroot}
Sergio Pascual 3bd41f7
Sergio Pascual c40d0b7
find %{buildroot} -name "*.so" | xargs chmod 755
Sergio Pascual c40d0b7
Sergio Pascual 84acc60
# checks fail with scipy 0.13
Sergio Pascual 84acc60
#%check
Sergio Pascual 3bd41f7
#%if 0%{?with_python3}
Sergio Pascual 3bd41f7
# pushd %{buildroot}/%{python3_sitearch}
Sergio Pascual 3bd41f7
# nosetests-3.3 sklearn
Sergio Pascual 3bd41f7
# popd
Sergio Pascual 3bd41f7
#%endif # with_python3
Sergio Pascual 3bd41f7
Sergio Pascual 84acc60
#pushd %{buildroot}/%{python_sitearch}
Sergio Pascual 84acc60
#nosetests sklearn
Sergio Pascual 84acc60
#popd
Sergio Pascual c40d0b7
 
Sergio Pascual c40d0b7
%files
Sergio Pascual c40d0b7
%doc examples/ AUTHORS.rst README.rst
Sergio Pascual c40d0b7
%{python_sitearch}/sklearn
Sergio Pascual c40d0b7
%{python_sitearch}/scikit_learn-*.egg-info
Sergio Pascual c40d0b7
Sergio Pascual 3bd41f7
%if 0%{?with_python3}
Sergio Pascual 3bd41f7
%files -n python3-%{upname}
Sergio Pascual 3bd41f7
%doc examples/ AUTHORS.rst README.rst
Sergio Pascual 3bd41f7
%{python3_sitearch}/sklearn
Sergio Pascual 3bd41f7
%{python3_sitearch}/scikit_learn-*.egg-info
Sergio Pascual 3bd41f7
%endif # with_python3
Sergio Pascual 3bd41f7
Sergio Pascual c40d0b7
%changelog
Sergio Pascual 3bd41f7
* Wed Aug 28 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.14.1-1
Sergio Pascual 3bd41f7
- New upstream source (0.14.1)
Sergio Pascual 84acc60
- Add python3 support
Sergio Pascual 84acc60
- Unbundle joblib and cblas
Sergio Pascual 3bd41f7
Sergio Pascual c40d0b7
* Wed Jul 10 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.13.1-3
Sergio Pascual c40d0b7
- Reorder buildrequires and requires
Sergio Pascual c40d0b7
- Dropped doc, it does not build
Sergio Pascual c40d0b7
Sergio Pascual c40d0b7
* Tue Jun 25 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.13.1-2
Sergio Pascual c40d0b7
- Changed package name
Sergio Pascual c40d0b7
- Tests do not need recompile
Sergio Pascual c40d0b7
Sergio Pascual c40d0b7
* Thu Apr 18 2013 Sergio Pascual <sergiopr@fedoraproject.org> - 0.13.1-1
Sergio Pascual c40d0b7
- Initial spec file