File uniconvw.spec of Package uniconvw

#
# spec file for package uniconvw
#
# Copyright (c) 2012 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:           uniconvw
Version:        1.1.5
Release:        0
License:        LGPL-2.0
Summary:        Front-end for UniConvertor Vector Graphics Translator
Url:            http://sk1project.org/
Group:          Productivity/Graphics/Convertors
Source0:        http://uniconvertor.googlecode.com/files/%{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE uniconvw-1.1.5-setup.patch lazy.kent.suse@gmail.com -- fix "standard-dir-owned-by-package" warning, don't install .xpm
Patch0:         uniconvw-1.1.5-setup.patch
BuildRequires:  ImageMagick
BuildRequires:  hicolor-icon-theme
%if 0%{?suse_version} >= 1210
BuildRequires:  python-distribute
%else
BuildRequires:  python-setuptools
%endif
BuildRequires:  update-desktop-files
Requires:       python-gtk
Requires:       uniconvertor
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%py_requires
BuildArch:      noarch

%description
uniconvw is a GTK front-end for UniConvertor.
UniConvertor is used as a backend library to convert one format to another.

%prep
%setup -q
%patch0
# Remove '/usr/bin/python' from scripts (rpmlint warnings).
sed -i '/\/usr\/bin\/python/d' src/__init__.py

%build
python setup.py build

%install
python setup.py install \
    --root=%{buildroot} \
    --prefix=%{_prefix} \
    --record-rpm=INSTALLED_FILES
# Install icons of various sizes.
install -Dm 644 src/%{name}.png \
    %{buildroot}%{_datadir}/icons/hicolor/64x64/apps/%{name}.png
for size in 48x48 32x32 22x22 16x16 ; do
install -dm 0755 \
    %{buildroot}%{_datadir}/icons/hicolor/${size}/apps
convert -resize ${size} src/%{name}.png \
    %{buildroot}%{_datadir}/icons/hicolor/${size}/apps/%{name}.png
done
%suse_update_desktop_file -i %{name}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files -f INSTALLED_FILES
%defattr(-,root,root)
%doc README
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/*/%{name}.png

%changelog
openSUSE Build Service is sponsored by