Blame ginga.spec

57e1016
%global sum Image Viewer and Toolkit
57e1016
%global common_desc                                                           \
57e1016
Ginga is a toolkit designed for building viewers for scientific image data in \
57e1016
Python, visualizing 2D pixel data in numpy arrays. It can view astronomical   \
57e1016
data such as contained in files based on the FITS (Flexible Image Transport   \
57e1016
System) file format. It is written and is maintained by software engineers at \
57e1016
the Subaru Telescope, National Astronomical Observatory of Japan.             \
57e1016
                                                                              \
57e1016
The Ginga toolkit centers around an image display class which supports zooming\
57e1016
and panning, color and intensity mapping, a choice of several automatic cut   \
57e1016
levels algorithms and canvases for plotting scalable geometric forms. In      \
57e1016
addition to this widget, a general purpose “reference” FITS viewer is         \
57e1016
provided, based on a plugin framework. A fairly complete set of standard      \
57e1016
plugins are provided for features that we expect from a modern FITS viewer:   \
57e1016
panning and zooming windows, star catalog access, cuts, star pick/fwhm,       \
57e1016
thumbnails, etc.
57e1016
57e1016
Name:           ginga
57e1016
Version:        2.5.20161005204600
57e1016
Release:        1%{?dist}
57e1016
Summary:        %{sum}
57e1016
# License breakdown
57e1016
#
57e1016
# In general (if not listed below): BSD
57e1016
#
57e1016
# Apache 2.0
57e1016
#   astropy_helpers/astropy_helpers/sphinx/themes/bootstrap-astropy/static/bootstrap-astropy.css
57e1016
#   ginga/util/heaptimer.py
57e1016
# 
57e1016
# MIT/X11
57e1016
#   ginga/util/six.py
57e1016
#
57e1016
License:        BSD and ASL 2.0 and MIT
57e1016
URL:            https://ejeschke.github.io/ginga/
57e1016
Source0:        https://files.pythonhosted.org/packages/source/g/%{name}/%{name}-%{version}.tar.gz
57e1016
57e1016
# General build reqs
57e1016
BuildRequires:  desktop-file-utils
57e1016
BuildRequires:  fontpackages-devel
57e1016
BuildRequires:  google-roboto-fonts
57e1016
# Python 2 build reqs
57e1016
BuildRequires:  python2-astropy
57e1016
BuildRequires:  python2-astropy-helpers
57e1016
BuildRequires:  python2-devel
57e1016
BuildRequires:  python2-matplotlib-qt5
57e1016
BuildRequires:  python2-qt5
57e1016
BuildRequires:  python2-scipy
57e1016
# Python 3 build reqs
57e1016
BuildRequires:  python3-astropy
57e1016
BuildRequires:  python3-astropy-helpers
57e1016
BuildRequires:  python3-devel
57e1016
BuildRequires:  python3-matplotlib-qt5
57e1016
BuildRequires:  python3-qt5
57e1016
BuildRequires:  python3-scipy
57e1016
57e1016
Requires:       python3-%{name} = %{version}-%{release}
57e1016
57e1016
BuildArch:      noarch
57e1016
57e1016
%description
57e1016
%{common_desc}
57e1016
57e1016
%package -n python2-%{name}
57e1016
Summary:        %{sum}
57e1016
%{?python_provide:%python_provide python2-%{name}}
57e1016
Requires:       google-roboto-fonts
57e1016
Requires:       python2-astropy
57e1016
Requires:       python2-matplotlib-qt5
57e1016
Requires:       python2-qt5
57e1016
Requires:       python2-scipy
57e1016
57e1016
%description -n python2-%{name}
57e1016
%{common_desc}
57e1016
57e1016
%package -n python2-%{name}-examples
57e1016
Summary:        Examples for %{name}
57e1016
%{?python_provide:%python_provide python2-%{name}-examples}
57e1016
Requires:       python2-%{name} = %{version}-%{release}
57e1016
57e1016
%description -n python2-%{name}-examples
57e1016
Examples for %{name}
57e1016
57e1016
%package -n python3-%{name}
57e1016
Summary:        %{sum}
57e1016
%{?python_provide:%python_provide python3-%{name}}
57e1016
Requires:       google-roboto-fonts
57e1016
Requires:       python3-astropy
57e1016
Requires:       python3-matplotlib-qt5
57e1016
Requires:       python3-qt5
57e1016
Requires:       python3-scipy
57e1016
57e1016
%description -n python3-%{name}
57e1016
%{common_desc}
57e1016
57e1016
%package -n python3-%{name}-examples
57e1016
Summary:        Examples for %{name}
57e1016
%{?python_provide:%python_provide python3-%{name}-examples}
57e1016
Requires:       python3-%{name} = %{version}-%{release}
57e1016
57e1016
%description -n python3-%{name}-examples
57e1016
Examples for %{name}
57e1016
57e1016
57e1016
%prep
57e1016
%autosetup
57e1016
cp -r ginga/examples examples-py2
57e1016
cp -r ginga/examples examples-py3
57e1016
# Fix wrong Python interpreters (upstream uses env)
57e1016
find examples-py2 -name '*.py' | xargs sed -i '1s|^#!.*|#!%{__python2}|'
57e1016
find examples-py3 -name '*.py' | xargs sed -i '1s|^#!.*|#!%{__python3}|'
57e1016
57e1016
%build
57e1016
%py2_build
57e1016
%py3_build
57e1016
57e1016
%install
57e1016
# Must do the python2 install first because the scripts in /usr/bin are
57e1016
# overwritten with every setup.py install, and in general we want the
57e1016
# python3 version to be the default.
57e1016
%py2_install
57e1016
%py3_install
57e1016
desktop-file-install                                    \
57e1016
     --dir=%{buildroot}%{_datadir}/applications         \
57e1016
     %{name}.desktop
57e1016
57e1016
# Replace bundled fonts with symlinks to system fonts
57e1016
# python2-ginga
57e1016
rm -f %{buildroot}/%{python2_sitelib}/%{name}/fonts/Roboto/*
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Black.ttf %{buildroot}/%{python2_sitelib}/%{name}/fonts/Roboto/Roboto-Black.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Bold.ttf %{buildroot}/%{python2_sitelib}/%{name}/fonts/Roboto/Roboto-Bold.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Light.ttf %{buildroot}/%{python2_sitelib}/%{name}/fonts/Roboto/Roboto-Light.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Medium.ttf %{buildroot}/%{python2_sitelib}/%{name}/fonts/Roboto/Roboto-Medium.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Regular.ttf %{buildroot}/%{python2_sitelib}/%{name}/fonts/Roboto/Roboto-Regular.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Thin.ttf %{buildroot}/%{python2_sitelib}/%{name}/fonts/Roboto/Roboto-Thin.ttf
57e1016
# python3-ginga
57e1016
rm -f %{buildroot}/%{python3_sitelib}/%{name}/fonts/Roboto/*
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Black.ttf %{buildroot}/%{python3_sitelib}/%{name}/fonts/Roboto/Roboto-Black.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Bold.ttf %{buildroot}/%{python3_sitelib}/%{name}/fonts/Roboto/Roboto-Bold.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Light.ttf %{buildroot}/%{python3_sitelib}/%{name}/fonts/Roboto/Roboto-Light.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Medium.ttf %{buildroot}/%{python3_sitelib}/%{name}/fonts/Roboto/Roboto-Medium.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Regular.ttf %{buildroot}/%{python3_sitelib}/%{name}/fonts/Roboto/Roboto-Regular.ttf
57e1016
ln -sf %{_fontbasedir}/google-roboto/Roboto-Thin.ttf %{buildroot}/%{python3_sitelib}/%{name}/fonts/Roboto/Roboto-Thin.ttf
57e1016
57e1016
# ginga/web/pgw/ipg.py has wrong permissions
57e1016
chmod 755 %{buildroot}/%{python2_sitelib}/%{name}/web/pgw/ipg.py
57e1016
chmod 755 %{buildroot}/%{python2_sitelib}/%{name}/util/mosaic.py
57e1016
chmod 755 %{buildroot}/%{python3_sitelib}/%{name}/web/pgw/ipg.py
57e1016
chmod 755 %{buildroot}/%{python3_sitelib}/%{name}/util/mosaic.py
57e1016
57e1016
# Fix wrong interpreters in some scripts...
57e1016
find %{buildroot}/%{python2_sitelib}/%{name} -name '*.py' | xargs sed -i '1s|^#!.*|#!%{__python2}|'
57e1016
find %{buildroot}/%{python3_sitelib}/%{name} -name '*.py' | xargs sed -i '1s|^#!.*|#!%{__python3}|'
57e1016
57e1016
%post
57e1016
/usr/bin/update-desktop-database &> /dev/null || :
57e1016
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
57e1016
57e1016
%postun
57e1016
/usr/bin/update-desktop-database &> /dev/null || :
57e1016
if [ $1 -eq 0 ] ; then
57e1016
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
57e1016
    /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
57e1016
fi
57e1016
57e1016
%posttrans
57e1016
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
57e1016
57e1016
57e1016
%files
57e1016
%license licenses/LICENSE.txt
57e1016
%doc README.txt
57e1016
%{_bindir}/*
57e1016
%{_datadir}/applications/%{name}.desktop
57e1016
57e1016
%files -n python2-%{name}
57e1016
%license licenses/LICENSE.txt
57e1016
%doc README.txt
57e1016
%{python2_sitelib}/*
57e1016
# Examples are shipped as documentation in examples subpackage
57e1016
%exclude %{python2_sitelib}/%{name}/examples
57e1016
57e1016
%files -n python2-%{name}-examples
57e1016
%license licenses/LICENSE.txt
57e1016
%doc examples-py2/*
57e1016
57e1016
%files -n python3-%{name}
57e1016
%license licenses/LICENSE.txt
57e1016
%doc README.txt
57e1016
%{python3_sitelib}/*
57e1016
# Examples are shipped as documentation in examples subpackage
57e1016
%exclude %{python3_sitelib}/%{name}/examples
57e1016
57e1016
%files -n python3-%{name}-examples
57e1016
%license licenses/LICENSE.txt
57e1016
%doc examples-py3/*
57e1016
57e1016
%changelog
57e1016
* Sat Oct 22 2016 Christian Dersch <lupinix@mailbox.org> - 2.5.20161005204600-1
57e1016
- new version
57e1016
- unbundled fonts
57e1016
- fixed interpreters for scripts to use correct Python version
57e1016
57e1016
* Sun Oct  2 2016 Christian Dersch <lupinix@mailbox.org> - 2.5.20160926130800-1
57e1016
- initial package