File auto-cpufreq.spec of Package auto-cpufreq
#
# spec file for package auto-cpufreq
#
# Copyright (c) 2022 SUSE LLC
#
# 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 pythons python3
Name: auto-cpufreq
Version: 1.9.8
Release: 0
Summary: Automatic CPU speed & power optimizer
License: GPL-3.0-or-later
URL: https://github.com/AdnanHodzic/auto-cpufreq
Source: https://github.com/AdnanHodzic/auto-cpufreq/archive/v%{version}.tar.gz
Patch0: auto-cpufreq-paths.patch
BuildRequires: %{python_module base}
BuildRequires: %{python_module certifi}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python3-click
Requires: python3-distro
Requires: python3-psutil
BuildArch: noarch
%python_subpackages
%description
Automatic CPU speed & power optimizer for Linux based on active
monitoring of laptop's battery state, CPU usage, CPU temperature and system load.
%prep
%autosetup -p1
sed -i 's|usr/local|usr|g' "scripts/auto-cpufreq.service" auto_cpufreq/core.py
%build
%pyproject_wheel
%install
%pyproject_install
install -Dm755 scripts/cpufreqctl.sh -t %{buildroot}%{_datadir}/auto-cpufreq/scripts
install -Dm644 scripts/auto-cpufreq.service -t %{buildroot}/%{_unitdir}
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%pre
%service_add_pre auto-cpufreq.service
%post
%service_add_post auto-cpufreq.service
%preun
%service_del_preun auto-cpufreq.service
%postun
%service_del_postun auto-cpufreq.service
%files -n auto-cpufreq
%{_bindir}/*
%{_unitdir}/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{python_sitelib}/
%changelog