File gourmet.spec of Package gourmet

#
# spec file for package gourmet
#
# Copyright (c) 2016 SUSE LINUX 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:           gourmet
Version:        0.17.4
Release:        0
Summary:        Recipes Management Application
License:        GPL-2.0
Group:          Productivity/Office/Other
Url:            http://grecipe-manager.sourceforge.net
Source:         https://github.com/thinkle/%{name}/archive/%{version}.tar.gz
# PATCH-FIX-UPSTREAM removed-python-shebang.patch sf#3275762 cbosdonnat@novell.com -- cleaned shebang in modules
Patch0:         removed-python-shebang.patch
BuildRequires:  ImageMagick
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  inkscape
BuildRequires:  intltool
BuildRequires:  python-devel
BuildRequires:  update-desktop-files
Requires:       python-base
BuildRequires:  python-distutils-extra
# The gnome python module is really used, so this is not about the meta-package
Requires:       python-gnome
%if 0%{?suse_version} <= 1130
# For gtkspell
Requires:       python-gnome-extras
%else
Requires:       python-gtkspell
%endif
Requires:       python-gtk
Requires:       python-imaging
Requires:       python-poppler
Requires:       python-reportlab
Requires:       python-sqlalchemy
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%py_requires

%description
Gourmet Recipe Manager is a recipe-organizer that allows you to collect, search,
organize, and browse your recipes. Gourmet can also generate shopping lists and
calculate nutritional information. It imports Mealmaster, MasterCook and KRecipe
files and exports PDFs, webpages and other formats.

%lang_package
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1

%build
python setup.py build

%install
python setup.py install --root=%{buildroot} --prefix="%{_prefix}"

# INSTALL APPLICATION ICONS
cp data/icons/scalable/apps/gourmet.svg gourmet.svg
for i in 24 32 48 64 128 256;
do
  convert -strip -density ${i}x -geometry ${i}x gourmet.svg %{name}-${i}x${i}.png
  install -Dm0644 %{name}-${i}x${i}.png %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/%{name}.png
done
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps

desktop-file-install build/share/applications/gourmet.desktop \
   --add-category="Office;ProjectManagement;" \
   --copy-name-to-generic-name

%find_lang %{name} %{?no_lang_C}
rm -fr %{buildroot}%{_datadir}/doc/%{name}

# gourmet expects to find the resource directory in %{python_sitelib}/gourmet/data rather than %{_datadir}/gourmet: see https://github.com/thinkle/gourmet/issues/762
# ln -s %{_datadir}/%{name} %{buildroot}%{python_sitelib}/%{name}/data

%post
%icon_theme_cache_post
%desktop_database_post

%postun
%icon_theme_cache_postun
%desktop_database_postun

%files
%defattr(-, root, root)
%doc README.md FAQ CHANGES CODING.md LICENSE ChangeLog
%{_bindir}/gourmet
%{_datadir}/gourmet/
%{_datadir}/applications/gourmet.desktop
%{python_sitelib}/gourmet/
%{python_sitelib}/*.egg-info
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%dir %{_datadir}/appdata
%{_datadir}/appdata/gourmet.appdata.xml

%files lang -f %{name}.lang

%changelog