Blob Blame History Raw
%global with_python3 1

Name:           APLpy
Version:        1.0
Release:        3%{?dist}
Summary:        The Astronomical Plotting Library in Python

Group:          Development/Languages
License:        MIT
URL:            http://aplpy.github.com
Source0:        https://pypi.python.org/packages/source/A/%{name}/%{name}-%{version}.tar.gz
Patch0:         aplpy-system-decorator.patch

BuildArch:      noarch
BuildRequires:  python2-devel numpy python-matplotlib python-astropy
BuildRequires:  python-matplotlib-tk pytest python-decorator
# For checks
BuildRequires:  python-nose python-pillow
Requires:       numpy python-matplotlib python-astropy python-decorator
Requires:       python-nose

%description
APLpy (the Astronomical Plotting Library in Python) is a Python module aimed at 
producing publication-quality plots of astronomical imaging data in FITS format.
The module uses Matplotlib, a powerful and interactive plotting package. It is
capable of creating output files in several graphical formats, including EPS,
PDF, PS, PNG, and SVG.

Main features:

o Make plots interactively or using scripts
o Show grayscale, colorscale, and 3-color RGB images of FITS files
o Generate co-aligned FITS cubes to make 3-color RGB images
o Overlay any number of contour sets
o Overlay markers with fully customizable symbols
o Plot customizable shapes like circles, ellipses, and rectangles
o Overlay ds9 region files
o Overlay coordinate grids
o Show colorbars, scalebars, and beams
o Customize the appearance of labels and ticks
o Hide, show, and remove different contour and marker layers
o Pan, zoom, and save any view as a full publication-quality plot
o Save plots as EPS, PDF, PS, PNG, and SVG 

%if 0%{?with_python3}
%package -n python3-APLpy
Summary:        The Astronomical Plotting Library in Python

BuildRequires:  python3-devel python3-numpy python3-matplotlib python3-astropy
BuildRequires:  python3-matplotlib-tk python3-pytest python3-decorator
# For checks
BuildRequires:  python3-nose python3-pillow
Requires:       python3-numpy python3-matplotlib python3-astropy python3-decorator
Requires:       python3-nose

%description -n python3-APLpy
APLpy (the Astronomical Plotting Library in Python) is a Python module aimed at 
producing publication-quality plots of astronomical imaging data in FITS format.
The module uses Matplotlib, a powerful and interactive plotting package. It is
capable of creating output files in several graphical formats, including EPS,
PDF, PS, PNG, and SVG.

Main features:

o Make plots interactively or using scripts
o Show grayscale, colorscale, and 3-color RGB images of FITS files
o Generate co-aligned FITS cubes to make 3-color RGB images
o Overlay any number of contour sets
o Overlay markers with fully customizable symbols
o Plot customizable shapes like circles, ellipses, and rectangles
o Overlay ds9 region files
o Overlay coordinate grids
o Show colorbars, scalebars, and beams
o Customize the appearance of labels and ticks
o Hide, show, and remove different contour and marker layers
o Pan, zoom, and save any view as a full publication-quality plot
o Save plots as EPS, PDF, PS, PNG, and SVG 

%endif # 0%{?with_python3}

%prep
%setup -q -n %{name}-%{version}
rm -rf aplpy/decorator.py
%patch0 -p1

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # 0%{?with_python3}

find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|'

%build
%{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # 0%{?with_python3}

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

%{__python2} setup.py install --skip-build --root %{buildroot}

%check
# Fake matplotlibrc
mkdir matplotlib
touch matplotlib/matplotlibrc
export XDG_CONFIG_HOME=`pwd`
pushd %{buildroot}/%{python2_sitelib}
py.test-%{python2_version} aplpy
popd
# Disable python3 tests
# https://github.com/aplpy/aplpy/issues/229
%if 0%{?with_python3}
pushd %{buildroot}/%{python3_sitelib}
py.test-%{python3_version} aplpy
popd
%endif # 0%{?with_python3}

%files
%doc CHANGES.rst README.rst
%license LICENSE.rst
%{python2_sitelib}/%{name}-%{version}-py%{python2_version}.egg-info
%{python2_sitelib}/aplpy/

%if 0%{?with_python3}
%files -n python3-APLpy
%doc CHANGES.rst README.rst
%license LICENSE.rst
%{python3_sitelib}/%{name}-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/aplpy/
%endif # 0%{?with_python3}

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

* Tue Jun 16 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Mar 02 2015 Sergio Pascual <sergiopr@fedoraproject.org> - 1.0-1
- New upstream version (1.0)
- Use license macro

* Thu Dec 11 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.9.14-2
- Disable python3 tests

* Thu Dec 11 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.9.14-1
- New upstream source (0.9.14), several bug fixes

* Tue Oct 07 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.9.13-1
- New upstream source (0.9.13), fixes bug in 0.9.11 and 0.9.12

* Thu Sep 11 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.9.12-2
- Provide python3 subpackage
- Unbundle decorator

* Thu Sep 11 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.9.12-1
- New upstream source (0.9.12)
- Tests enabled

* Wed Sep 10 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.9.11-2
- Disable tests for the moment

* Tue Jul 08 2014 Sergio Pascual <sergiopr@fedoraproject.org> - 0.9.11-1
- Updated to new version
- Run tests on installed version
- Use python2 macros

* Fri Jun 06 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.8-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri Aug 02 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.8-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu May 03 2012 Germán A. Racca <skytux@fedoraproject.org> - 0.9.8-1
- Updated to new version
- Included tests in %%check and corresponding BRs
- Packaged tests in %%doc section

* Mon Feb 06 2012 Germán A. Racca <skytux@fedoraproject.org> 0.9.6-3
- Minor changes to spec file after approval
- Removed INSTALL file

* Mon Jan 30 2012 Germán A. Racca <skytux@fedoraproject.org> 0.9.6-2
- Changed name of spec file to match the project name

* Mon Jan 23 2012 Germán A. Racca <skytux@fedoraproject.org> 0.9.6-1
- Initial release of RPM package