From 00cf6eaf68f690dfe7b8ef2f07285a75b626140e Mon Sep 17 00:00:00 2001 From: mcgillij Date: Sun, 7 Jul 2024 03:21:35 -0300 Subject: [PATCH] revert the PKGBUILD temporarily since it's blocking the build and fix the broken tests, will have to redo how the commands are put togther, however this will work for now. --- PKGBUILD | 27 +++++++++++++++++++++++++++ tests/test_cli.py | 17 ++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 PKGBUILD diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..68f3b6e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,27 @@ +# Maintainer: Jason McGillivray < mcgillivray dot jason at gmail dot com> + + +pkgname=amdfan +pkgdesc="Python daemon for controlling the fans on amdgpu cards" +pkgver=0.2.0 +pkgrel=1 +arch=('any') +license=('GPL2') +depends=('python' 'python-yaml' 'python-numpy' 'python-rich' 'python-click') +makedepends=('python-poetry-core' 'python-build' 'python-installer') +url="https://github.com/mcgillij/amdfan" +source=("https://github.com/mcgillij/amdfan/releases/download/$pkgver/amdfan-$pkgver.tar.gz") +#source=("amdfan-$pkgver.tar.gz") +md5sums=('58db7ccf6255d4866efc75cc9c89a66a') + +build() { + cd "$srcdir/$pkgname-$pkgver" + python -m build --wheel --no-isolation +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + python -m installer --destdir="$pkgdir" dist/*.whl + mkdir -p "$pkgdir/usr/lib/systemd/system" + install -Dm644 src/amdfan/amdfan.service "$pkgdir/usr/lib/systemd/system/" +} diff --git a/tests/test_cli.py b/tests/test_cli.py index 81e7637..bfc6935 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -2,30 +2,25 @@ from click.testing import CliRunner -from amdfan.commands import cli +from amdfan.commands import cli, run_daemon, set_fan_speed class TestCli(unittest.TestCase): def test_params(self): - daemon_param = ["daemon"] runner = CliRunner() - result = runner.invoke(cli, daemon_param) + result = runner.invoke(run_daemon) assert result.exception assert result.exit_code == 1 # should be permission denied for non-root - help_param = ["--help"] - result = runner.invoke(cli, help_param) + result = runner.invoke(cli, ["--help"]) assert result.exit_code == 0 - config_param = ["print-default", "--configuration"] - result = runner.invoke(cli, config_param) + result = runner.invoke(cli, ["--configuration"]) assert result.exit_code == 0 - service_param = ["print-default", "--service=systemd"] - result = runner.invoke(cli, service_param) + result = runner.invoke(cli, ["--service=systemd"]) assert result.exit_code == 0 - manual_param = "set" - result = runner.invoke(cli, manual_param, input="\n".join(["card0", "25"])) + result = runner.invoke(set_fan_speed, input="\n".join(["card0", "25"])) assert result.exception assert result.exit_code == 1 # should be permission denied for non-root