File menulibre.spec of Package menulibre

#
# spec file for package menulibre
#
# Copyright (c) 2014 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:           menulibre
Version:        2.0.6
Release:        0
License:        GPL-3.0
Summary:        An advanced menu editor
Url:            http://smdavis.us/projects/menulibre/
Group:          System/GUI/Other
Source:         https://launchpad.net/menulibre/2.0/%{version}/+download/%{name}-%{version}.tar.gz
BuildRequires:  gettext-runtime
BuildRequires:  girepository-1_0
BuildRequires:  gnome-menus
BuildRequires:  intltool
BuildRequires:  python3-setuptools
BuildRequires:  python3
BuildRequires:  python3-base
BuildRequires:  python3-distutils-extra
BuildRequires:  python3-gobject
BuildRequires:  python3-psutil
BuildRequires:  typelib-1_0-GdkPixbuf-2_0
BuildRequires:  typelib-1_0-GMenu-3_0
BuildRequires:  typelib-1_0-Gtk-3_0
BuildRequires:  xdg-utils
BuildRequires:  fdupes
# Needed for typelib() - Requires.
BuildRequires:  gobject-introspection
Requires:       gdk-pixbuf-loader-rsvg
Requires:       gnome-icon-theme-symbolic
Requires:       python3
Requires:       python3-gobject
Requires:       python3-psutil
Requires:       psutils
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
An advanced menu editor that provides modern features in a clean, easy-to-use
interface. All without GNOME dependencies, so even lightweight systems can
benefit from the sanity that MenuLibre offers. MenuLibre is your one-stop shop
for menus in Linux, whether you use Gnome, LXDE, XFCE, or Unity.

%lang_package

%prep
%setup -q
sed -i 's/Соханить/Сохранить/' po/ru.po

%build
export XDG_RUNTIME_DIR=/tmp
python3 ./setup.py build

%install
rm -rf %{buildroot}
install -dm 0755 %{buildroot}%{_datadir}/locale
cp -a build/mo/* %{buildroot}%{_datadir}/locale/
install -Dm 0644 build/share/applications/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
export XDG_RUNTIME_DIR=/tmp
export LC_ALL=en_US.UTF-8
python3 ./setup.py install --skip-build \
    --prefix="%{_prefix}" \
    --root="%{buildroot}" \
    --record-rpm=files.lst
rm -rf %{buildroot}%{_datadir}/doc
grep -rl '^#!' %{buildroot}%{python3_sitelib}/%{name}* | xargs chmod 0755
%fdupes %{buildroot}%{_datadir}/icons/hicolor/

%find_lang %{name}

# Python byte compile.
pushd %{buildroot}%{python3_sitelib}/%{name}_lib/__pycache__
%py3_compile ..
popd

%clean
rm -rf %{buildroot}

%post
%icon_theme_cache_post

%postun
%icon_theme_cache_postun

%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.svg
%{_datadir}/pixmaps/%{name}.png
%{_mandir}/man?/%{name}.*
%{python3_sitelib}/%{name}-%{version}-py%{py3_ver}.egg-info
%{python3_sitelib}/%{name}/
%{python3_sitelib}/%{name}_lib/
%dir %{_datadir}/%{name}/
%dir %{_datadir}/%{name}/ui/
%{_datadir}/%{name}/ui/*.ui

%files lang -f %{name}.lang

%changelog