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

Name: python-%{upname}
Version: 0.4.0
Release: 2%{?dist}
Summary: Astronomical source extraction and photometry in Python

License: MIT and LGPLv3+ 

URL: http://sep.readthedocs.org/
Source0: https://pypi.python.org/packages/source/s/sep/sep-%{version}.tar.gz

BuildRequires: python2-devel python-setuptools
BuildRequires: numpy

Requires: numpy

%description
SEP makes available some of the astronomical source extraction and 
photometry algorithms in Source Extractor as stand-alone 
functions and classes. These operate directly on in-memory numpy arrays 
(no FITS files, configuration files, etc). It’s derived directly from 
(and tested against) the Source Extractor code base.

%if 0%{?with_python3}
%package -n python3-%{upname}
Summary: Astronomical source extraction and photometry in Python
BuildRequires: python3-devel python3-setuptools
BuildRequires: python3-numpy

Requires: python3-numpy

%description -n python3-%{upname}
SEP makes available some of the astronomical source extraction and 
photometry algorithms in Source Extractor as stand-alone 
functions and classes. These operate directly on in-memory numpy arrays 
(no FITS files, configuration files, etc). It’s derived directly from 
(and tested against) the Source Extractor code base.

%endif # with_python3

%prep
%setup -q -n %{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
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} 
chmod 755 %{buildroot}/%{python3_sitearch}/sep*.so
popd
%endif # with_python3

%{__python2} setup.py install --skip-build --root %{buildroot} 
chmod 755 %{buildroot}/%{python2_sitearch}/sep.so

%files
%doc AUTHORS.md README.md CHANGES.md
%license licenses/MIT_LICENSE.md licenses/LGPL_LICENSE.txt
%{python2_sitearch}/*

%if 0%{?with_python3}
%files -n python3-%{upname}
%doc AUTHORS.md README.md CHANGES.md
%license licenses/MIT_LICENSE.md licenses/LGPL_LICENSE.txt
%{python3_sitearch}/*
%endif # with_python3

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

* Mon Jun 08 2015 Sergio Pascual <sergio.pasra@gmail.com> - 0.4.0-1
- New upstream (0.4.0)

* Tue Dec 16 2014 Sergio Pascual <sergio.pasra@gmail.com> - 0.2.0-1
- Initial specfile