File caffeine.spec of Package caffeine
#
# spec file for package caffeine
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2011 Malcolm J Lewis <malcolmlewis@opensuse.org>
#
# 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 https://bugs.opensuse.org/
#
%define __requires_exclude typelib\\(AyatanaAppIndicator3\\)
#{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: caffeine
Version: 2.9.12
Release: 0
Summary: Utility to inhibit screensaver and sleep modes
License: GPL-3.0-or-later AND LGPL-3.0-or-later
Group: System/GUI/GNOME
URL: https://pypi.org/project/cups-of-caffeine/
Source0: cups-of-caffeine-2.9.12.tar.gz
#URL: https://launchpad.net/caffeine
#Source0: https://launchpad.net/~caffeine-developers/+archive/ubuntu/ppa/+sourcefiles/caffeine/%{version}/%{name}_%{version}.tar.xz
# PATCH-FIX-UPSTREAM caffeine-fix-desktop-file-semicolon-trailing-character p.drouand@gmail.com -- Fix missing semicolon in Keywords entries.
Patch1: caffeine-fix-desktop-file-semicolon-trailing-character.patch
BuildRequires: fdupes
# For typelib() Requires
BuildRequires: gobject-introspection
BuildRequires: hicolor-icon-theme
# hicolor should be used for this instead
#BuildRequires: ubuntu-mono-icon-theme
#BuildRequires: %{python_module devel}
#BuildRequires: %{python_module setuptools}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: update-desktop-files
BuildRequires: xz
Requires: python3-ewmh
Requires: python3-pyxdg
Requires: python3-xlib
Provides: %{name}-lang = %{version}
Obsoletes: %{name}-lang < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
#{?python_enable_dependency_generator}
#python_subpackages
%description
Caffeine is a status bar application able to temporarily prevent the
activation of both the screensaver and the "sleep" powersaving mode.
%prep
%autosetup -p1 -n cups-of-caffeine-%{version}
%build
%python3_build
%install
%python3_install
%suse_update_desktop_file -G Caffeine -r -u %{buildroot}%{_datadir}/applications/caffeine.desktop Utility TrayIcon
%suse_update_desktop_file -G Caffeine -r -u %{buildroot}%{_sysconfdir}/xdg/autostart/%{name}.desktop Utility TrayIcon
%find_lang %{name}-indicator
%python_expand %fdupes %{buildroot}%{python_sitelib}
# Remove ubuntu icons for now
rm -rf %{buildroot}%{_datadir}/icons/ubuntu-mono-*
# remove trash
find %{buildroot}%{_prefix} -type f -maxdepth 1 -delete
# remove dangling alternative files
mv -v $(dirname %{buildroot}%{python3_sitelib}) ./TMP || echo woopsie
rm -rfv $(dirname $(dirname %{buildroot}%{python3_sitelib}))/python* || echo woopsie
mv -v ./TMP $(dirname %{buildroot}%{python3_sitelib}) || echo woopsie
%post
%desktop_database_post
%icon_theme_cache_post
%postun
%desktop_database_postun
%icon_theme_cache_postun
%files -f %{name}-indicator.lang
%defattr(-,root,root)
%doc README.md
%{_bindir}/caffein*
#{python3_sitelib}/ewmh*
#{python3_sitelib}/__pycache__/ewmh*
%{python3_sitelib}/*
%{_datadir}/caffeine-indicator
%{_datadir}/applications/caffeine*.desktop
%{_datadir}/icons/*/*/*/caffeine*
%{_datadir}/pixmaps/caffeine.*
%{_mandir}/man?/caffein*%{?ext_man}
%{_sysconfdir}/xdg/autostart/caffeine.desktop
%changelog