File keepnote.spec of Package keepnote

#
# spec file for package keepnote
#
# 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:           keepnote
Version:        0.7.8
Release:        0
License:        GPL-2.0
Summary:        Note Taking and Organization
Url:            http://keepnote.org/
Group:          Productivity/Office/Organizers
Source0:        http://keepnote.org/download/%{name}-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
%if 0%{?suse_version} >= 1210
BuildRequires:  python-distribute
%else
BuildRequires:  python-setuptools
%endif
BuildRequires:  python-pysqlite
BuildRequires:  python-xml
BuildRequires:  update-desktop-files
Requires:       python-gtk
Requires:       python-pysqlite
Requires:       python-xml
Recommends:     %{name}-lang
Recommends:     ImageMagick
Recommends:     python-gtkspell
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%py_requires

%description
KeepNote is a note taking application that works on Windows, Linux, and
MacOS X. With KeepNote, you can store your class notes, TODO lists,
research notes, journal entries, paper outlines, etc in a simple
notebook hierarchy with rich-text formatting, images, and more. Using
full-text search, you can retrieve any note for later reference.

%lang_package

%prep
%setup -q
# Remove '/usr/bin/env' from scripts (rpmlint warnings).
sed -i '/\/usr\/bin\/env/d' %{name}/tarfile.py

%build

%install
# Don't use "record-rpm" — it records system directories.
python setup.py install \
    --root=%{buildroot} \
    --prefix=%{_prefix} \
    --record=INSTALLED_FILES
# Remove locales from the list. Record them later.
sed -i '/locale/d' INSTALLED_FILES
# Remove useless suffix UTF8.
pushd %{buildroot}%{python_sitelib}/%{name}/rc/locale
for dir in *.UTF8 ; do
    mv -f "${dir}" "${dir%.UTF8}"
done
popd
%find_lang %{name}
%fdupes -s %{buildroot}%{python_sitelib}
%suse_update_desktop_file -r %{name} Office Database

%post
%icon_theme_cache_post

%postun
%icon_theme_cache_postun

%files -f INSTALLED_FILES
%defattr(-,root,root,-)
%doc CHANGES COPYING LICENSE README
%dir %{python_sitelib}/%{name}
%dir %{python_sitelib}/%{name}/*
%dir %{python_sitelib}/%{name}/*/*
%dir %{python_sitelib}/%{name}/*/*/*
%exclude %{python_sitelib}/%{name}/rc/locale

%files lang -f %{name}.lang
%defattr(-,root,root,-)
%dir %{python_sitelib}/%{name}/rc/locale
%dir %{python_sitelib}/%{name}/rc/locale/*
%dir %{python_sitelib}/%{name}/rc/locale/*/LC_MESSAGES

%changelog
openSUSE Build Service is sponsored by