File mugshot.spec of Package mugshot

#
# spec file for package mugshot
#
# Copyright (c) 2018 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/
#


%define series 0.4
Name:           mugshot
Version:        0.4.0
Release:        0
Summary:        A lightweight user-configuration application
License:        GPL-3.0-or-later
Group:          System/Management
URL:            https://launchpad.net/mugshot
Source:         https://launchpad.net/mugshot/%{series}/%{version}/+download/%{name}-%{version}.tar.gz
BuildRequires:  dbus-1-python3
BuildRequires:  fdupes
# Needed for typelib() - Requires.
BuildRequires:  gobject-introspection
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  pkgconfig
BuildRequires:  python3-distutils-extra
# Runtime dependencies:
BuildRequires:  python3-gobject
BuildRequires:  python3-pexpect
BuildRequires:  pkgconfig(glib-2.0)
Requires:       accountsservice
Requires:       dbus-1-python3
Requires:       gdk-pixbuf-loader-rsvg
Requires:       gsettings-backend-dconf
Requires:       python3-cairo
Requires:       python3-gobject
Requires:       python3-gobject-Gdk
Requires:       python3-pexpect
Requires:       shadow
Requires:       sudo
Recommends:     %{name}-lang
Suggests:       gnome-control-center-user-faces
Suggests:       gstreamer-plugins-good-extra
Suggests:       gstreamer-utils
BuildArch:      noarch
%glib2_gsettings_schema_requires

%description
Mugshot is a lightweight, easy-to-use user configuration utility.  It allows
you to easily set profile image and user details for your user profile and any
supported applications.  This is great for quick profile updates and frequent
image refreshes.

%lang_package

%prep
%setup -q

%build
python3 ./setup.py build

%install
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 LC_ALL=C.UTF-8
python3 ./setup.py install --skip-build \
    --prefix=%{_prefix} \
    --root=%{buildroot}
rm -rf %{buildroot}%{_datadir}/doc
sed -i "/^Exec/s|%{_bindir}/||" %{buildroot}%{_datadir}/applications/%{name}.desktop
grep -rl '^#!' %{buildroot}%{python3_sitelib}/%{name}* | xargs chmod 0755
%fdupes %{buildroot}%{_datadir}/icons/hicolor/
rm -f %{buildroot}%{_datadir}/%{name}/ui/CameraMugshotDialog.ui~

%find_lang %{name}

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

%if 0%{?suse_version} <= 1320
%post
%glib2_gsettings_schema_post
%icon_theme_cache_post

%postun
%glib2_gsettings_schema_postun
%icon_theme_cache_postun
%endif

%files
%doc AUTHORS COPYING NEWS README
%{_bindir}/%{name}
%dir %{_datadir}/%{name}/
%dir %{_datadir}/%{name}/metainfo/
%dir %{_datadir}/%{name}/ui/
%{_datadir}/%{name}/metainfo/%{name}.appdata.xml.in
%{_datadir}/%{name}/ui/*.ui
%{_datadir}/%{name}/ui/*.xml
%dir %{_datadir}/metainfo/
%{_datadir}/metainfo/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/glib-2.0/schemas/apps.%{name}.gschema.xml
%{_datadir}/icons/hicolor/*/apps/%{name}.svg
%{_mandir}/man?/%{name}.?%{ext_man}
%{python3_sitelib}/%{name}-%{version}-py%{py3_ver}.egg-info
%{python3_sitelib}/%{name}/
%{python3_sitelib}/%{name}_lib/

%files lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by