File pyxtrlock.spec of Package pyxtrlock

Name:           pyxtrlock
Version:        0.2
Release:        15%{?dist}
Summary:        The X transparent screen lock rewritten in Python
License:        GPL-3.0-or-later
URL:            https://zombofant.net/hacking/pyxtrlock
Source0:        %{name}-%{version}.tar.xz
Source1:        %{name}.png

BuildArch:      noarch
BuildRequires:  python3-devel
BuildRequires:  desktop-file-utils

# Note: explicit lib dependencies because these are used through python ctypes,
# hence not picked up automatically by rpm.
Requires:       libX11-xcb1
Requires:       libxcb-image0
Requires:       python3-simplepam

%description
pyxtrlock, like its predecessor xtrlock, is a very minimal X display lock
program. While pyxtrlock is running, it does not obscure the screen, only the
mouse and keyboard are grabbed and the mouse cursor becomes a padlock. Output
displayed by X programs, and windows put up by new X clients, continue to be
visible, and any new output is displayed normally.

%prep
%setup -q


%build
%{__python3} setup.py build


%install
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
rm %{buildroot}%{python3_sitelib}/*.egg-info

mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/pixmaps

cat >> %{buildroot}/%{name}.desktop << EOF
[Desktop Entry]
Name=pyxtrlock
GenericName=Screen Lock
Comment=Screen Lock
Encoding=UTF-8
Icon=%{name}
Exec=%{name}
Terminal=false
Type=Application
Categories=Security;
EOF

desktop-file-install \
    --delete-original \
    --dir=%{buildroot}%{_datadir}/applications \
    %{buildroot}/%{name}.desktop

cp -a %{SOURCE1} %{buildroot}%{_datadir}/pixmaps/


%files
%doc README.md CHANGELOG COPYING
%{_bindir}/%{name}
%{python3_sitelib}/%{name}/
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png


%changelog