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

Name:           python-%{upname}
Version:        0.3
Release:        16%{?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:  python2-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

%global _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.\


%description %_description

%package -n python2-astroML
Summary:        %summary
Requires:       python2-numpy
Requires:       python2-astropy
Requires:       python2-matplotlib
Requires:       python2-scikit-learn
Requires:       python2-scipy
Recommends:     python2-healpy
%{?python_provide:%python_provide python2-%{upname}}

%description -n python2-%{upname} %_description

%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
Recommends:     python3-healpy
%{?python_provide:%python_provide python3-%{upname}}

%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
# Disabled tests as they do not work properly right now :(
#%if 0%{?with_python3}
#pushd %{py3dir}
#xvfb-run -a nosetests-%{python3_version}
#popd
#%endif # with_python3
#xvfb-run -a nosetests-%{python2_version}


%files -n python2-%{upname}
%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 Oct 17 2017 Christian Dersch <lupinix@mailbox.org> - 0.3-16
- Recommend healpy, an optional dependency of astroML

* Mon Aug 21 2017 Christian Dersch <lupinix@mailbox.org> - 0.3-15
- Fixed Python 2 renaming

* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.3-14
- Python 2 binary package renamed to python2-astroml
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.3-11
- Rebuild for Python 3.6

* Mon Sep 26 2016 Dominik Mierzejewski <rpm@greysector.net> - 0.3-10
- rebuilt for matplotlib-2.0.0

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3-9
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Wed Mar 30 2016 Björn Esser <fedora@besser82.io> - 0.3-8
- Require python2-scikit-learn

* Fri Mar 25 2016 Christian Dersch <lupinix@mailbox.org> - 0.3-7
- rebuilt

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

* Wed Nov 25 2015 Christian Dersch <lupinix@mailbox.org> - 0.3-5
- Rebuilt for updates in Python 3.5

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

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

* Tue Feb 24 2015 Christian Dersch <chrisdersch@gmail.com> - 0.3-2
- small spec fixes

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

* 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