Blob Blame History Raw
# Many modules not packaged. Some of them deprecated.
%bcond_with tests

%global pypi_name linux_thermaltake_rgb
%global sys_name linux_thermaltake_riing

Name: linux-thermaltake-rgb
Version: 0.2.0
Release: %autorelease
Summary: Python driver and daemon to control thermaltake Riing fans and pumps
BuildArch: noarch

License: GPLv2

# GitHub source because pypi version outdated
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz

BuildRequires: python3-devel
BuildRequires: systemd-rpm-macros
BuildRequires: python3dist(setuptools)

%if %{with tests}
# BuildRequires: python3dist(base_test_object)
# BuildRequires: python3dist(pep8)
# BuildRequires: python3dist(usb)
BuildRequires: python3dist(pytest)

Linux driver and daemon for Thermaltake Riing

Currently supported devices are (as they show up in thermaltakes TTRGBPLUS

- Flow Riing RGB
- Lumi Plus LED Strip
- Pacific PR22-D5 Plus
- Pacific Rad Plus LED Panel
- Pacific V-GTX 1080Ti Plus GPU Waterblock
- Pacific W4 Plus CPU Waterblock
- Riing Plus

%autosetup -n %{sys_name}-%{version} -p1
sed -i 's/PROJECTVERSION/%{version}/g'
# Fixed missing 1 positional argument in daemon/
# For newer versions of python yaml, Simply loading the config with
# yaml.load(cfg) does not work due to it being deprecated, It has been fixed
# here.
sed -i 's/yaml.load(cfg)/yaml.load(cfg, Loader=yaml.FullLoader)/' \

# fix wrong package requirement for GObject
sed -i 's/GObject/PyGObject/g'

# Remove bundled egg-info
rm -rf %{name}.egg-info



mkdir -p %{buildroot}%{_unitdir}
mv %{buildroot}%{_datadir}/%{pypi_name}/%{name}.service \

mkdir -p %{buildroot}%{_sysconfdir}/%{pypi_name}
mv %{buildroot}%{_datadir}/%{pypi_name}/config.yml \

%if %{with tests}
%{python3} -m pytest -v

%systemd_post %{name}.service

%systemd_preun %{name}.service

%systemd_postun_with_restart %{name}.service

%license LICENSE.txt
%doc roadmap.txt protocol.txt
%config(noreplace) %{_sysconfdir}/%{pypi_name}/config.yml
%dir %{_sysconfdir}/%{pypi_name}