Blob Blame History Raw
%global upname astroML
%global with_python3 1

Name:           python-%{upname}
Version:        0.3
Release:        1%{?dist}
Summary:        Python tools for machine learning and data mining in Astronomy

License:        BSD
URL:            http://www.astroml.org/
Source0:        https://github.com/%{upname}/%{upname}/archive/v%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  numpy
BuildRequires:  python-astropy
BuildRequires:  python2-devel
BuildRequires:  python-matplotlib
BuildRequires:  python-nose
BuildRequires:  python-scikit-learn
BuildRequires:  python-setuptools
BuildRequires:  scipy
BuildRequires:  xorg-x11-server-Xvfb
%if 0%{?with_python3}
BuildRequires:  python3-astropy
BuildRequires:  python3-devel
BuildRequires:  python3-matplotlib
BuildRequires:  python3-nose
BuildRequires:  python3-numpy
BuildRequires:  python3-scikit-learn
BuildRequires:  python3-setuptools
BuildRequires:  python3-scipy
%endif

Requires:       numpy
Requires:       python-astropy
Requires:       python-matplotlib
Requires:       python-scikit-learn
Requires:       scipy

%description
AstroML is a Python module for machine learning and data mining built on
numpy, scipy, scikit-learn, and matplotlib, and distributed under the
3-clause BSD license. It contains a growing library of statistical and
machine learning routines for analyzing astronomical data in python,
loaders for several open astronomical datasets, and a large suite of
examples of analyzing and visualizing astronomical datasets.


%if 0%{?with_python3}
%package -n python3-%{upname}
Summary:        Python tools for machine learning and data mining in Astronomy

Requires:       python3-numpy
Requires:       python3-astropy
Requires:       python3-matplotlib
Requires:       python3-scikit-learn
Requires:       python3-scipy

%description -n python3-%{upname}
AstroML is a Python module for machine learning and data mining built on
numpy, scipy, scikit-learn, and matplotlib, and distributed under the
3-clause BSD license. It contains a growing library of statistical and
machine learning routines for analyzing astronomical data in python,
loaders for several open astronomical datasets, and a large suite of
examples of analyzing and visualizing astronomical datasets.
%endif


%package doc
Summary:        Docs and examples for the %{upname} package

%description doc
Documentation and examples for %{upname}.


%prep
%setup -qn %{upname}-%{version}
%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
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%{__python2} ./setup.py build


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


%check
%if 0%{?with_python3}
pushd %{py3dir}
xvfb-run -a nosetests-py3.4
popd
%endif # with_python3
xvfb-run -a nosetests


%files
%license LICENSE.rst
%doc CHANGES.rst CITATION README.rst
%{python2_sitelib}/%{upname}
%{python2_sitelib}/%{upname}-%{version}-*.egg-info

%files doc
%license LICENSE.rst
%doc CHANGES.rst CITATION README.rst book_figures examples paper_figures

%if 0%{?with_python3}
%files -n python3-%{upname}
%license LICENSE.rst
%doc CHANGES.rst CITATION README.rst
%{python3_sitelib}/%{upname}
%{python3_sitelib}/%{upname}-%{version}-*.egg-info
%endif # with_python3


%changelog
* Tue Feb 24 2015 Christian Dersch <chrisdersch@gmail.com> - 0.3-1
- new upstream release 0.3
- initial Python 3 support

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

* Mon Mar 17 2014 Christian Dersch <chrisdersch@gmail.com> - 0.2-2
- fixed spec to match packaging guidelines

* Mon Feb 24 2014 Christian Dersch <chrisdersch@gmail.com> - 0.2-1
- upgrade to version 0.2, addons is now a seperate package (upstream change)

* Thu Oct 17 2013 Christian Dersch <chrisdersch@gmail.com> - 0.1.2-2
- fixed spec to match packaging guidelines

* Thu Oct 10 2013 Christian Dersch <chrisdersch@gmail.com> - 0.1.2-1
- initial spec