File djvusmooth.spec of Package djvusmooth

#
# spec file for package djvusmooth
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           djvusmooth
Version:        0.2.14
Release:        0
Summary:        Graphical Text Editor for DjVu
License:        GPL-2.0
Group:          Productivity/Publishing/Other
Url:            http://jwilk.net/software/djvusmooth
Source0:        http://pypi.python.org/packages/source/d/%{name}/%{name}-%{version}.tar.gz
Source1:        http://pypi.python.org/packages/source/d/%{name}/%{name}-%{version}.tar.gz.asc
Source2:        djvusmooth.png
Source3:        %{name}.keyring
BuildRequires:  desktop-file-utils
%if 0%{?suse_version} >= 1230
BuildRequires:  gpg-offline
%endif
BuildRequires:  hicolor-icon-theme
%if 0%{?suse_version} >= 1210
BuildRequires:  python-distribute
%else
BuildRequires:  python-setuptools
%endif
# Not actually needed for build, but in order to make the build fail
# if the runtime dependencies are not available in the repository:
BuildRequires:  python-devel
BuildRequires:  python-djvulibre
Requires:       djvulibre
Requires:       python-djvulibre
Requires:       python-wxWidgets
Requires:       python-xdg
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
DjVuSmooth is a graphical text editor for DjVu documents.

%lang_package

%prep
%if 0%{?gpg_verify:1}
%gpg_verify %{SOURCE1}
%endif
%setup -q

%build

%install
# Replace desktop file. Provided one isn't good enough.
cat > extra/%{name}.desktop << EOF
[Desktop Entry]
Name=DjVuSmooth
GenericName=Graphical Text Editor for DjVu
GenericName[pl]=Graficzny edytor plików DjVu
GenericName[ru]=Текстовый редактор DjVu-книг
Comment=Graphical Text Editor for DjVu
Comment[pl]=Graficzny edytor plików DjVu
Comment[ru]=Граффический текстовый редактор для DjVu-книг
Type=Application
Exec=djvusmooth %f
Icon=djvusmooth
Categories=Utility;TextEditor;
StartupNotify=true
Terminal=false
MimeType=image/x-djvu;image/x.djvu;image/vnd.djvu;
EOF

python setup.py install \
    --root=%{buildroot} \
    --prefix=%{_prefix}
install -Dm 0644 %{SOURCE2} \
    %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png

%find_lang %{name}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root,-)
%doc COPYING doc/changelog
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/*/%{name}.png
%doc %{_mandir}/man?/*
%{python_sitelib}/*

%files lang -f %{name}.lang

%changelog