File key-mon.spec of Package key-mon

#
# spec file for package key-mon
#
# Copyright (c) 2013 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/
#


%define oname   keymon

Name:           key-mon
Version:        1.19
Release:        0
Summary:        Keyboard Status Monitor
License:        Apache-2.0
Group:          System/X11/Utilities
Url:            https://github.com/scottkirkwood/key-mon
# Downloaded from https://github.com/scottkirkwood/key-mon
# Packed as tar.bz2
Source0:        %{name}-%{version}+git-2022.01.19-d609880.tar.bz2
Source1:        %{name}-rpmlintrc
BuildRequires:  python3
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
BuildRequires:  fdupes
BuildArch:      noarch
Requires:       python3-xlib
Requires:       xorg-x11-server
#py3_requires
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Utility to show live keyboard and mouse status for teaching and screencasts.

%prep
%setup -q -n %{name}

# Remove not needed files
rm -f src/keymon/themes/clear/config~

%build
python3 setup.py build

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

# install icons
for i in 16 24 32 48 64 128 ; do
    install -Dm 0644 icons/hicolor/${i}x${i}/apps/%{name}.png %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/%{name}.png
done

# install Desktop file
install -Dm 0644 icons/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop

# install man
install -Dm 0644 man/%{name}.include %{buildroot}%{_mandir}/man1/%{name}.1

# install appdata
mkdir -p %{buildroot}%{_datadir}/appdata
install -m 0644 %{name}.appdata.xml %{buildroot}%{_datadir}/appdata

%suse_update_desktop_file -i -r %{name} Utility DesktopUtility Accessibility

%fdupes -s %{buildroot}%{_prefix}

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root,-)
%doc ACKNOWLEDGMENTS.rst LICENSE-2.0.txt README.rst RELEASE.rst
%{_mandir}/man1/%{name}.1%{ext_man}
%{_bindir}/%{name}
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/icons/hicolor/%{name}.*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/appdata
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/pixmaps/%{name}.xpm
%{python3_sitelib}/%{oname}
%{python3_sitelib}/key_mon-%{version}-py%{py3_ver}.egg-info

%changelog
openSUSE Build Service is sponsored by