mirror of
https://github.com/dw-0/kiauh.git
synced 2026-08-03 12:57:53 +05:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42a998d454 | ||
|
|
ab60f8cddc | ||
|
|
428a53829c | ||
|
|
87d20fe7e0 | ||
|
|
859d3436ca | ||
|
|
4208d5a984 |
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
@@ -23,11 +24,10 @@ from components.klipper import (
|
|||||||
KLIPPER_SERVICE_TEMPLATE,
|
KLIPPER_SERVICE_TEMPLATE,
|
||||||
KLIPPER_UDS_NAME,
|
KLIPPER_UDS_NAME,
|
||||||
)
|
)
|
||||||
from core.constants import CURRENT_USER
|
|
||||||
from core.instance_manager.base_instance import BaseInstance
|
from core.instance_manager.base_instance import BaseInstance
|
||||||
from core.logger import Logger
|
from core.logger import Logger
|
||||||
from utils.fs_utils import create_folders, get_data_dir
|
from utils.fs_utils import create_folders, get_data_dir
|
||||||
from utils.sys_utils import get_service_file_path
|
from utils.sys_utils import get_current_user, get_service_file_path
|
||||||
|
|
||||||
|
|
||||||
# noinspection PyMethodMayBeStatic
|
# noinspection PyMethodMayBeStatic
|
||||||
@@ -93,7 +93,7 @@ class Klipper:
|
|||||||
|
|
||||||
service_content = template_content.replace(
|
service_content = template_content.replace(
|
||||||
"%USER%",
|
"%USER%",
|
||||||
CURRENT_USER,
|
get_current_user(),
|
||||||
)
|
)
|
||||||
service_content = service_content.replace(
|
service_content = service_content.replace(
|
||||||
"%KLIPPER_DIR%",
|
"%KLIPPER_DIR%",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import grp
|
|
||||||
import os
|
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import CalledProcessError, run
|
from subprocess import CalledProcessError, run
|
||||||
@@ -28,7 +27,6 @@ from components.klipper.klipper_dialogs import (
|
|||||||
)
|
)
|
||||||
from components.webui_client.base_data import BaseWebClient
|
from components.webui_client.base_data import BaseWebClient
|
||||||
from components.webui_client.client_utils import create_client_config_symlink
|
from components.webui_client.client_utils import create_client_config_symlink
|
||||||
from core.constants import CURRENT_USER
|
|
||||||
from core.instance_manager.base_instance import SUFFIX_BLACKLIST
|
from core.instance_manager.base_instance import SUFFIX_BLACKLIST
|
||||||
from core.logger import DialogType, Logger
|
from core.logger import DialogType, Logger
|
||||||
from core.services.backup_service import BackupService
|
from core.services.backup_service import BackupService
|
||||||
@@ -42,6 +40,8 @@ from utils.input_utils import get_confirm, get_number_input, get_string_input
|
|||||||
from utils.instance_utils import get_instances
|
from utils.instance_utils import get_instances
|
||||||
from utils.sys_utils import (
|
from utils.sys_utils import (
|
||||||
cmd_sysctl_service,
|
cmd_sysctl_service,
|
||||||
|
get_current_user,
|
||||||
|
get_user_groups,
|
||||||
install_python_packages,
|
install_python_packages,
|
||||||
parse_packages_from_file,
|
parse_packages_from_file,
|
||||||
)
|
)
|
||||||
@@ -93,12 +93,14 @@ def check_user_groups(interactive: bool = True) -> None:
|
|||||||
must confirm before groups are modified. When ``interactive`` is false (the
|
must confirm before groups are modified. When ``interactive`` is false (the
|
||||||
headless CLI path), groups are added automatically without prompting.
|
headless CLI path), groups are added automatically without prompting.
|
||||||
"""
|
"""
|
||||||
user_groups = [grp.getgrgid(gid).gr_name for gid in os.getgroups()]
|
user_groups = get_user_groups()
|
||||||
missing_groups = [g for g in ["tty", "dialout"] if g not in user_groups]
|
missing_groups = [g for g in ["tty", "dialout"] if g not in user_groups]
|
||||||
|
|
||||||
if not missing_groups:
|
if not missing_groups:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
current_user = get_current_user()
|
||||||
|
|
||||||
if interactive:
|
if interactive:
|
||||||
Logger.print_dialog(
|
Logger.print_dialog(
|
||||||
DialogType.ATTENTION,
|
DialogType.ATTENTION,
|
||||||
@@ -116,22 +118,22 @@ def check_user_groups(interactive: bool = True) -> None:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
if not get_confirm(f"Add user '{CURRENT_USER}' to group(s) now?"):
|
if not get_confirm(f"Add user '{current_user}' to group(s) now?"):
|
||||||
log = "Skipped adding user to required groups. You might encounter issues."
|
log = "Skipped adding user to required groups. You might encounter issues."
|
||||||
Logger.print_warn(log)
|
Logger.print_warn(log)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
Logger.print_info(
|
Logger.print_info(
|
||||||
f"Adding user '{CURRENT_USER}' to required groups: "
|
f"Adding user '{current_user}' to required groups: "
|
||||||
f"{', '.join(missing_groups)}"
|
f"{', '.join(missing_groups)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for group in missing_groups:
|
for group in missing_groups:
|
||||||
Logger.print_status(f"Adding user '{CURRENT_USER}' to group {group} ...")
|
Logger.print_status(f"Adding user '{current_user}' to group {group} ...")
|
||||||
command = ["sudo", "usermod", "-a", "-G", group, CURRENT_USER]
|
command = ["sudo", "usermod", "-a", "-G", group, current_user]
|
||||||
run(command, check=True)
|
run(command, check=True)
|
||||||
Logger.print_ok(f"Group {group} assigned to user '{CURRENT_USER}'.")
|
Logger.print_ok(f"Group {group} assigned to user '{current_user}'.")
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
Logger.print_error(f"Unable to add user to usergroups: {e}")
|
Logger.print_error(f"Unable to add user to usergroups: {e}")
|
||||||
raise
|
raise
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
@@ -330,10 +339,11 @@ class TestCheckUserGroups:
|
|||||||
def test_interactive_mode_prompts_before_adding_user(self, monkeypatch) -> None:
|
def test_interactive_mode_prompts_before_adding_user(self, monkeypatch) -> None:
|
||||||
from components.klipper.klipper_utils import check_user_groups
|
from components.klipper.klipper_utils import check_user_groups
|
||||||
|
|
||||||
monkeypatch.setattr("os.getgroups", lambda: [])
|
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"grp.getgrgid",
|
"components.klipper.klipper_utils.get_user_groups", lambda: []
|
||||||
lambda gid: type("Group", (), {"gr_name": "tty"})(),
|
)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"components.klipper.klipper_utils.get_current_user", lambda: "tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
prompted: List[str] = []
|
prompted: List[str] = []
|
||||||
@@ -357,10 +367,11 @@ class TestCheckUserGroups:
|
|||||||
def test_headless_mode_auto_adds_without_prompt(self, monkeypatch) -> None:
|
def test_headless_mode_auto_adds_without_prompt(self, monkeypatch) -> None:
|
||||||
from components.klipper.klipper_utils import check_user_groups
|
from components.klipper.klipper_utils import check_user_groups
|
||||||
|
|
||||||
monkeypatch.setattr("os.getgroups", lambda: [])
|
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"grp.getgrgid",
|
"components.klipper.klipper_utils.get_user_groups", lambda: []
|
||||||
lambda gid: type("Group", (), {"gr_name": "tty"})(),
|
)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"components.klipper.klipper_utils.get_current_user", lambda: "tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import (
|
from subprocess import (
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import field
|
from dataclasses import field
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from core.constants import SYSTEMD
|
from core.constants import SYSTEMD
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import CalledProcessError, run
|
from subprocess import CalledProcessError, run
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
@@ -22,14 +23,13 @@ from components.moonraker import (
|
|||||||
MOONRAKER_LOG_NAME,
|
MOONRAKER_LOG_NAME,
|
||||||
MOONRAKER_SERVICE_TEMPLATE,
|
MOONRAKER_SERVICE_TEMPLATE,
|
||||||
)
|
)
|
||||||
from core.constants import CURRENT_USER
|
|
||||||
from core.instance_manager.base_instance import BaseInstance
|
from core.instance_manager.base_instance import BaseInstance
|
||||||
from core.logger import Logger
|
from core.logger import Logger
|
||||||
from core.simple_config_parser.simple_config_parser import (
|
from core.simple_config_parser.simple_config_parser import (
|
||||||
SimpleConfigParser,
|
SimpleConfigParser,
|
||||||
)
|
)
|
||||||
from utils.fs_utils import create_folders
|
from utils.fs_utils import create_folders
|
||||||
from utils.sys_utils import get_service_file_path
|
from utils.sys_utils import get_current_user, get_service_file_path
|
||||||
|
|
||||||
|
|
||||||
# noinspection PyMethodMayBeStatic
|
# noinspection PyMethodMayBeStatic
|
||||||
@@ -98,7 +98,7 @@ class Moonraker:
|
|||||||
|
|
||||||
service_content = template_content.replace(
|
service_content = template_content.replace(
|
||||||
"%USER%",
|
"%USER%",
|
||||||
CURRENT_USER,
|
get_current_user(),
|
||||||
)
|
)
|
||||||
service_content = service_content.replace(
|
service_content = service_content.replace(
|
||||||
"%MOONRAKER_DIR%",
|
"%MOONRAKER_DIR%",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# It was modified by Dominik Willner <th33xitus@gmail.com> #
|
# It was modified by Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# The original file is part of Moonraker: #
|
# The original file is part of Moonraker: #
|
||||||
# https://github.com/Arksine/moonraker #
|
# https://github.com/Arksine/moonraker #
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
@@ -14,10 +15,10 @@ import shutil
|
|||||||
from json import JSONDecodeError
|
from json import JSONDecodeError
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import PIPE, CalledProcessError, run
|
from subprocess import PIPE, CalledProcessError, run
|
||||||
from typing import List, get_args
|
from typing import List
|
||||||
|
|
||||||
from components.klipper.klipper import Klipper
|
from components.klipper.klipper import Klipper
|
||||||
from components.webui_client import MODULE_PATH
|
from components.webui_client import CLIENTS, MODULE_PATH
|
||||||
from components.webui_client.base_data import (
|
from components.webui_client.base_data import (
|
||||||
BaseWebClient,
|
BaseWebClient,
|
||||||
BaseWebClientConfig,
|
BaseWebClientConfig,
|
||||||
@@ -40,7 +41,7 @@ from core.simple_config_parser.simple_config_parser import (
|
|||||||
from core.types.color import Color
|
from core.types.color import Color
|
||||||
from core.types.component_status import ComponentStatus
|
from core.types.component_status import ComponentStatus
|
||||||
from utils.common import get_install_status
|
from utils.common import get_install_status
|
||||||
from utils.fs_utils import create_symlink, remove_file
|
from utils.fs_utils import create_symlink, remove_with_sudo
|
||||||
from utils.git_utils import (
|
from utils.git_utils import (
|
||||||
get_latest_remote_tag,
|
get_latest_remote_tag,
|
||||||
get_latest_unstable_tag,
|
get_latest_unstable_tag,
|
||||||
@@ -230,13 +231,8 @@ def backup_client_config_data(client: BaseWebClient) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def get_existing_clients() -> List[BaseWebClient]:
|
def get_existing_clients() -> List[BaseWebClient]:
|
||||||
clients = list(get_args(WebClientType))
|
clients: List[BaseWebClient] = [bwc() for bwc in CLIENTS.values()]
|
||||||
installed_clients: List[BaseWebClient] = []
|
return [client for client in clients if client.client_dir.exists()]
|
||||||
for client in clients:
|
|
||||||
if client.client_dir.exists():
|
|
||||||
installed_clients.append(client)
|
|
||||||
|
|
||||||
return installed_clients
|
|
||||||
|
|
||||||
|
|
||||||
def detect_client_cfg_conflict(curr_client: BaseWebClient) -> bool:
|
def detect_client_cfg_conflict(curr_client: BaseWebClient) -> bool:
|
||||||
@@ -357,7 +353,7 @@ def create_nginx_cfg(
|
|||||||
|
|
||||||
source = NGINX_SITES_AVAILABLE.joinpath(cfg_name)
|
source = NGINX_SITES_AVAILABLE.joinpath(cfg_name)
|
||||||
target = NGINX_SITES_ENABLED.joinpath(cfg_name)
|
target = NGINX_SITES_ENABLED.joinpath(cfg_name)
|
||||||
remove_file(Path("/etc/nginx/sites-enabled/default"), True)
|
remove_with_sudo(Path("/etc/nginx/sites-enabled/default"))
|
||||||
generate_nginx_cfg_from_template(cfg_name, template_src=template_src, **kwargs)
|
generate_nginx_cfg_from_template(cfg_name, template_src=template_src, **kwargs)
|
||||||
create_symlink(source, target, True)
|
create_symlink(source, target, True)
|
||||||
set_nginx_permissions()
|
set_nginx_permissions()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|||||||
+2
-1
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from types import SimpleNamespace
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@@ -14,6 +24,7 @@ from components.webui_client.client_utils import (
|
|||||||
get_client_status,
|
get_client_status,
|
||||||
get_current_client_config,
|
get_current_client_config,
|
||||||
get_download_url,
|
get_download_url,
|
||||||
|
get_existing_clients,
|
||||||
get_local_client_version,
|
get_local_client_version,
|
||||||
get_next_free_port,
|
get_next_free_port,
|
||||||
get_nginx_listen_port,
|
get_nginx_listen_port,
|
||||||
@@ -346,3 +357,56 @@ class TestGetCurrentClientConfig:
|
|||||||
|
|
||||||
result = get_current_client_config()
|
result = get_current_client_config()
|
||||||
assert "Mainsail-Config" in result
|
assert "Mainsail-Config" in result
|
||||||
|
|
||||||
|
|
||||||
|
class TestGetExistingClients:
|
||||||
|
@staticmethod
|
||||||
|
def _client(installed: bool) -> SimpleNamespace:
|
||||||
|
return SimpleNamespace(client_dir=SimpleNamespace(exists=lambda: installed))
|
||||||
|
|
||||||
|
def test_returns_only_installed_clients(self, monkeypatch) -> None:
|
||||||
|
mainsail = self._client(installed=True)
|
||||||
|
fluidd = self._client(installed=False)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
client_utils,
|
||||||
|
"CLIENTS",
|
||||||
|
{"mainsail": lambda: mainsail, "fluidd": lambda: fluidd},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert get_existing_clients() == [mainsail]
|
||||||
|
|
||||||
|
def test_returns_only_fluidd_when_only_fluidd_installed(self, monkeypatch) -> None:
|
||||||
|
mainsail = self._client(installed=False)
|
||||||
|
fluidd = self._client(installed=True)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
client_utils,
|
||||||
|
"CLIENTS",
|
||||||
|
{"mainsail": lambda: mainsail, "fluidd": lambda: fluidd},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert get_existing_clients() == [fluidd]
|
||||||
|
|
||||||
|
def test_returns_both_clients_in_order_when_both_installed(
|
||||||
|
self, monkeypatch
|
||||||
|
) -> None:
|
||||||
|
mainsail = self._client(installed=True)
|
||||||
|
fluidd = self._client(installed=True)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
client_utils,
|
||||||
|
"CLIENTS",
|
||||||
|
{"mainsail": lambda: mainsail, "fluidd": lambda: fluidd},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert get_existing_clients() == [mainsail, fluidd]
|
||||||
|
|
||||||
|
def test_returns_empty_list_when_no_client_installed(self, monkeypatch) -> None:
|
||||||
|
monkeypatch.setattr(
|
||||||
|
client_utils,
|
||||||
|
"CLIENTS",
|
||||||
|
{
|
||||||
|
"mainsail": lambda: self._client(installed=False),
|
||||||
|
"fluidd": lambda: self._client(installed=False),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert get_existing_clients() == []
|
||||||
|
|||||||
+2
-1
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# #
|
# #
|
||||||
@@ -7,12 +7,13 @@
|
|||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, List, Protocol, Sequence, cast, runtime_checkable
|
from typing import Any, Protocol, Sequence, cast
|
||||||
|
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
# Singleton backends #
|
# Singleton backends #
|
||||||
@@ -26,27 +27,6 @@ from typing import Any, List, Protocol, Sequence, cast, runtime_checkable
|
|||||||
# per-module duplicates
|
# per-module duplicates
|
||||||
|
|
||||||
|
|
||||||
def run(cmd: str | List[str], **kwargs: Any) -> subprocess.CompletedProcess[str]:
|
|
||||||
"""Run a command through the shared command runner."""
|
|
||||||
return command_runner.run(cmd, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
def check_output(cmd: str | List[str], **kwargs: Any) -> str | bytes:
|
|
||||||
"""Run a command and return its output through the shared command runner."""
|
|
||||||
return command_runner.check_output(cmd, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
def call(cmd: str | List[str], **kwargs: Any) -> int:
|
|
||||||
"""Run a command and return its exit code through the shared command runner."""
|
|
||||||
return command_runner.call(cmd, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
def popen(cmd: str | List[str], **kwargs: Any) -> subprocess.Popen:
|
|
||||||
"""Start a process through the shared command runner."""
|
|
||||||
return command_runner.popen(cmd, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
@runtime_checkable
|
|
||||||
class CommandRunner(Protocol):
|
class CommandRunner(Protocol):
|
||||||
"""Pluggable backend for executing system commands."""
|
"""Pluggable backend for executing system commands."""
|
||||||
|
|
||||||
@@ -107,7 +87,6 @@ class SubprocessRunner:
|
|||||||
return subprocess.Popen(cmd, **kwargs)
|
return subprocess.Popen(cmd, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@runtime_checkable
|
|
||||||
class FilesystemBackend(Protocol):
|
class FilesystemBackend(Protocol):
|
||||||
"""Pluggable backend for filesystem operations."""
|
"""Pluggable backend for filesystem operations."""
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@@ -13,12 +23,14 @@ from utils import fs_utils, sys_utils
|
|||||||
class TestSubprocessRunner:
|
class TestSubprocessRunner:
|
||||||
def test_run_executes_command(self) -> None:
|
def test_run_executes_command(self) -> None:
|
||||||
runner = SubprocessRunner()
|
runner = SubprocessRunner()
|
||||||
result = runner.run(["true"])
|
result = runner.run([sys.executable, "-c", ""])
|
||||||
assert result.returncode == 0
|
assert result.returncode == 0
|
||||||
|
|
||||||
def test_check_output_returns_stdout(self) -> None:
|
def test_check_output_returns_stdout(self) -> None:
|
||||||
runner = SubprocessRunner()
|
runner = SubprocessRunner()
|
||||||
output = runner.check_output(["echo", "hello"], text=True)
|
output = runner.check_output(
|
||||||
|
[sys.executable, "-c", "print('hello')"], text=True
|
||||||
|
)
|
||||||
assert "hello" in output
|
assert "hello" in output
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -507,9 +516,10 @@ class TestPackaging:
|
|||||||
def test_pyproject_metadata_allows_editable_dev_install(self) -> None:
|
def test_pyproject_metadata_allows_editable_dev_install(self) -> None:
|
||||||
project_root = Path(__file__).resolve().parents[4]
|
project_root = Path(__file__).resolve().parents[4]
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
|
import sys
|
||||||
|
|
||||||
result = sp.run(
|
result = sp.run(
|
||||||
["python", "-m", "pip", "install", "--dry-run", "-e", ".[dev]"],
|
[sys.executable, "-m", "pip", "install", "--dry-run", "-e", ".[dev]"],
|
||||||
cwd=project_root,
|
cwd=project_root,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -7,8 +7,6 @@
|
|||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
import os
|
|
||||||
import pwd
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# global dependencies
|
# global dependencies
|
||||||
@@ -17,9 +15,6 @@ GLOBAL_DEPS = ["git", "wget", "curl", "unzip", "dfu-util", "python3-virtualenv"]
|
|||||||
# strings
|
# strings
|
||||||
INVALID_CHOICE = "Invalid choice. Please select a valid value."
|
INVALID_CHOICE = "Invalid choice. Please select a valid value."
|
||||||
|
|
||||||
# current user
|
|
||||||
CURRENT_USER = pwd.getpwuid(os.getuid())[0]
|
|
||||||
|
|
||||||
# dirs
|
# dirs
|
||||||
SYSTEMD = Path("/etc/systemd/system")
|
SYSTEMD = Path("/etc/systemd/system")
|
||||||
NGINX_SITES_AVAILABLE = Path("/etc/nginx/sites-available")
|
NGINX_SITES_AVAILABLE = Path("/etc/nginx/sites-available")
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
# ======================================================================= #
|
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
|
||||||
# #
|
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
|
||||||
# https://github.com/dw-0/kiauh #
|
|
||||||
# #
|
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
|
||||||
# ======================================================================= #
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import warnings
|
|
||||||
from typing import Callable
|
|
||||||
|
|
||||||
|
|
||||||
def deprecated(info: str = "", replaced_by: Callable | None = None) -> Callable:
|
|
||||||
def decorator(func) -> Callable:
|
|
||||||
def wrapper(*args, **kwargs):
|
|
||||||
msg = f"{info}{replaced_by.__name__ if replaced_by else ''}"
|
|
||||||
warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
|
|
||||||
return func(*args, **kwargs)
|
|
||||||
|
|
||||||
return wrapper
|
|
||||||
|
|
||||||
return decorator
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
@@ -14,8 +14,9 @@ import sys
|
|||||||
import textwrap
|
import textwrap
|
||||||
import traceback
|
import traceback
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
|
from contextlib import contextmanager
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Dict, Type
|
from typing import Dict, Iterator, Type
|
||||||
|
|
||||||
from core.logger import Logger
|
from core.logger import Logger
|
||||||
from core.menus import FooterType, Option
|
from core.menus import FooterType, Option
|
||||||
@@ -173,13 +174,32 @@ class BaseMenu(metaclass=PostInitCaller):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def is_loading(self, state: bool) -> None:
|
def is_loading(self, state: bool) -> None:
|
||||||
if not self.spinner and state:
|
if state:
|
||||||
|
if self.spinner is None:
|
||||||
self.spinner = Spinner(self.loading_msg)
|
self.spinner = Spinner(self.loading_msg)
|
||||||
self.spinner.start()
|
self.spinner.start()
|
||||||
else:
|
else:
|
||||||
|
if self.spinner is not None:
|
||||||
self.spinner.stop()
|
self.spinner.stop()
|
||||||
self.spinner = None
|
self.spinner = None
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def pause_loading(self) -> Iterator[None]:
|
||||||
|
"""Temporarily pause the loading spinner while an interactive command runs.
|
||||||
|
|
||||||
|
Use this around subprocess calls that may prompt the user on the
|
||||||
|
terminal (for example ``sudo`` asking for a password). Pausing clears
|
||||||
|
the spinner line so the prompt is not overwritten.
|
||||||
|
"""
|
||||||
|
spinner = self.spinner
|
||||||
|
if spinner is not None:
|
||||||
|
spinner.pause()
|
||||||
|
try:
|
||||||
|
yield
|
||||||
|
finally:
|
||||||
|
if spinner is not None:
|
||||||
|
spinner.resume()
|
||||||
|
|
||||||
def __print_menu_title(self) -> None:
|
def __print_menu_title(self) -> None:
|
||||||
count = 62 - len(str(self.title_color)) - len(str(Color.RST))
|
count = 62 - len(str(self.title_color)) - len(str(Color.RST))
|
||||||
menu_title = "╔═══════════════════════════════════════════════════════╗\n"
|
menu_title = "╔═══════════════════════════════════════════════════════╗\n"
|
||||||
@@ -233,6 +253,14 @@ class BaseMenu(metaclass=PostInitCaller):
|
|||||||
|
|
||||||
self.run()
|
self.run()
|
||||||
|
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
# Stop the spinner so the terminal is left in a clean state and the
|
||||||
|
# animation thread does not keep running during interpreter shutdown.
|
||||||
|
if self.spinner is not None:
|
||||||
|
self.spinner.stop()
|
||||||
|
self.spinner = None
|
||||||
|
raise
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Logger.print_error(
|
Logger.print_error(
|
||||||
f"An unexpected error occured:\n{e}\n{traceback.format_exc()}"
|
f"An unexpected error occured:\n{e}\n{traceback.format_exc()}"
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import List, Literal, Type
|
from typing import List, Literal, Type
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import List, Type
|
from typing import List, Type
|
||||||
@@ -88,6 +97,122 @@ class TestBaseMenuLifecycle:
|
|||||||
assert exits == [0]
|
assert exits == [0]
|
||||||
|
|
||||||
|
|
||||||
|
class TestBaseMenuLoading:
|
||||||
|
def test_is_loading_starts_and_stops_spinner(self, monkeypatch) -> None:
|
||||||
|
calls: list[str | tuple[str, str]] = []
|
||||||
|
|
||||||
|
class FakeSpinner:
|
||||||
|
def __init__(self, message: str) -> None:
|
||||||
|
calls.append(("init", message))
|
||||||
|
|
||||||
|
def start(self) -> None:
|
||||||
|
calls.append("start")
|
||||||
|
|
||||||
|
def stop(self) -> None:
|
||||||
|
calls.append("stop")
|
||||||
|
|
||||||
|
monkeypatch.setattr("core.menus.base_menu.Spinner", FakeSpinner)
|
||||||
|
menu = ConcreteMenu()
|
||||||
|
menu.loading_msg = "Test"
|
||||||
|
|
||||||
|
menu.is_loading(True)
|
||||||
|
assert calls[-2:] == [("init", "Test"), "start"]
|
||||||
|
|
||||||
|
menu.is_loading(False)
|
||||||
|
assert calls[-1] == "stop"
|
||||||
|
assert menu.spinner is None
|
||||||
|
|
||||||
|
def test_is_loading_true_twice_does_not_restart_spinner(self, monkeypatch) -> None:
|
||||||
|
calls: list[str | tuple[str, str]] = []
|
||||||
|
|
||||||
|
class FakeSpinner:
|
||||||
|
def __init__(self, message: str) -> None:
|
||||||
|
calls.append(("init", message))
|
||||||
|
|
||||||
|
def start(self) -> None:
|
||||||
|
calls.append("start")
|
||||||
|
|
||||||
|
def stop(self) -> None:
|
||||||
|
calls.append("stop")
|
||||||
|
|
||||||
|
monkeypatch.setattr("core.menus.base_menu.Spinner", FakeSpinner)
|
||||||
|
menu = ConcreteMenu()
|
||||||
|
|
||||||
|
menu.is_loading(True)
|
||||||
|
menu.is_loading(True)
|
||||||
|
assert calls.count("start") == 1
|
||||||
|
|
||||||
|
def test_pause_loading_pauses_and_resumes_active_spinner(self, monkeypatch) -> None:
|
||||||
|
calls: list[str] = []
|
||||||
|
|
||||||
|
class FakeSpinner:
|
||||||
|
def __init__(self, message: str) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def start(self) -> None:
|
||||||
|
calls.append("start")
|
||||||
|
|
||||||
|
def stop(self) -> None:
|
||||||
|
calls.append("stop")
|
||||||
|
|
||||||
|
def pause(self) -> None:
|
||||||
|
calls.append("pause")
|
||||||
|
|
||||||
|
def resume(self) -> None:
|
||||||
|
calls.append("resume")
|
||||||
|
|
||||||
|
monkeypatch.setattr("core.menus.base_menu.Spinner", FakeSpinner)
|
||||||
|
menu = ConcreteMenu()
|
||||||
|
menu.loading_msg = "Test"
|
||||||
|
menu.is_loading(True)
|
||||||
|
|
||||||
|
with menu.pause_loading():
|
||||||
|
calls.append("inside")
|
||||||
|
|
||||||
|
assert calls == ["start", "pause", "inside", "resume"]
|
||||||
|
|
||||||
|
def test_pause_loading_is_noop_when_no_spinner(self) -> None:
|
||||||
|
menu = ConcreteMenu()
|
||||||
|
# should not raise
|
||||||
|
with menu.pause_loading():
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_keyboard_interrupt_stops_active_spinner(self, monkeypatch) -> None:
|
||||||
|
calls: list[str] = []
|
||||||
|
|
||||||
|
class FakeSpinner:
|
||||||
|
def __init__(self, message: str) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def start(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def stop(self) -> None:
|
||||||
|
calls.append("stop")
|
||||||
|
|
||||||
|
def pause(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def resume(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
monkeypatch.setattr("core.menus.base_menu.Spinner", FakeSpinner)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"core.menus.base_menu.get_selection_input",
|
||||||
|
lambda *a, **k: (_ for _ in ()).throw(KeyboardInterrupt()),
|
||||||
|
)
|
||||||
|
|
||||||
|
menu = ConcreteMenu()
|
||||||
|
menu.loading_msg = "Test"
|
||||||
|
menu.is_loading(True)
|
||||||
|
|
||||||
|
with pytest.raises(KeyboardInterrupt):
|
||||||
|
menu.run()
|
||||||
|
|
||||||
|
assert "stop" in calls
|
||||||
|
assert menu.spinner is None
|
||||||
|
|
||||||
|
|
||||||
class TestMenuTitleStyle:
|
class TestMenuTitleStyle:
|
||||||
def test_style_values(self) -> None:
|
def test_style_values(self) -> None:
|
||||||
assert MenuTitleStyle.PLAIN.value == "plain"
|
assert MenuTitleStyle.PLAIN.value == "plain"
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -1,6 +1,16 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, List
|
from contextlib import contextmanager
|
||||||
|
from typing import Any, Generator, List
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from core.menus.update_menu import UpdateMenu
|
from core.menus.update_menu import UpdateMenu
|
||||||
@@ -53,6 +63,12 @@ def patched_menu(monkeypatch: pytest.MonkeyPatch) -> UpdateMenu:
|
|||||||
def stop(self):
|
def stop(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def pause(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def resume(self):
|
||||||
|
pass
|
||||||
|
|
||||||
monkeypatch.setattr("core.menus.base_menu.Spinner", FakeSpinner)
|
monkeypatch.setattr("core.menus.base_menu.Spinner", FakeSpinner)
|
||||||
|
|
||||||
return UpdateMenu()
|
return UpdateMenu()
|
||||||
@@ -156,6 +172,51 @@ class TestSystemUpdates:
|
|||||||
assert upgraded == [["curl", "git"]]
|
assert upgraded == [["curl", "git"]]
|
||||||
|
|
||||||
|
|
||||||
|
class TestSpinnerPauseDuringSystemUpdateFetch:
|
||||||
|
def test_fetch_system_package_status_pauses_spinner_during_apt_update(
|
||||||
|
self, monkeypatch: pytest.MonkeyPatch
|
||||||
|
) -> None:
|
||||||
|
"""The loading spinner must be paused while ``apt-get update`` runs so
|
||||||
|
that a possible sudo password prompt is not overwritten by the spinner.
|
||||||
|
"""
|
||||||
|
calls: list[str | tuple[str, bool]] = []
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def recording_pause_loading(self: UpdateMenu) -> Generator[None, None, None]:
|
||||||
|
calls.append("pause")
|
||||||
|
yield
|
||||||
|
calls.append("resume")
|
||||||
|
|
||||||
|
monkeypatch.setattr(UpdateMenu, "pause_loading", recording_pause_loading)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"core.menus.update_menu.update_system_package_lists",
|
||||||
|
lambda silent: calls.append(("apt", silent)),
|
||||||
|
)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"core.menus.update_menu.get_upgradable_packages",
|
||||||
|
lambda: ["curl"],
|
||||||
|
)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
"core.menus.update_menu.Logger.print_warn", lambda *a, **k: None
|
||||||
|
)
|
||||||
|
|
||||||
|
menu = UpdateMenu()
|
||||||
|
# the constructor already calls _fetch_system_package_update_status once
|
||||||
|
assert calls == ["pause", ("apt", True), "resume"]
|
||||||
|
|
||||||
|
menu._fetch_system_package_update_status()
|
||||||
|
|
||||||
|
# every fetch must pause the spinner around the apt call
|
||||||
|
assert calls == [
|
||||||
|
"pause",
|
||||||
|
("apt", True),
|
||||||
|
"resume",
|
||||||
|
"pause",
|
||||||
|
("apt", True),
|
||||||
|
"resume",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class TestUpdateAll:
|
class TestUpdateAll:
|
||||||
def test_update_all_invokes_each_component_update(
|
def test_update_all_invokes_each_component_update(
|
||||||
self, patched_menu: UpdateMenu, monkeypatch: pytest.MonkeyPatch
|
self, patched_menu: UpdateMenu, monkeypatch: pytest.MonkeyPatch
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
@@ -256,6 +257,7 @@ class UpdateMenu(BaseMenu):
|
|||||||
# even when package metadata is unavailable. Dependency installation still
|
# even when package metadata is unavailable. Dependency installation still
|
||||||
# fails fast elsewhere.
|
# fails fast elsewhere.
|
||||||
try:
|
try:
|
||||||
|
with self.pause_loading():
|
||||||
update_system_package_lists(silent=True)
|
update_system_package_lists(silent=True)
|
||||||
except RuntimeError as exc:
|
except RuntimeError as exc:
|
||||||
Logger.print_warn(
|
Logger.print_warn(
|
||||||
@@ -274,7 +276,7 @@ class UpdateMenu(BaseMenu):
|
|||||||
elif local_version != remote_version:
|
elif local_version != remote_version:
|
||||||
color = Color.YELLOW
|
color = Color.YELLOW
|
||||||
|
|
||||||
return str(Color.apply(local_version or '-', color))
|
return str(Color.apply(local_version or "-", color))
|
||||||
|
|
||||||
def _set_status_data(self, name: str, status_fn: Callable, *args) -> None:
|
def _set_status_data(self, name: str, status_fn: Callable, *args) -> None:
|
||||||
comp_status: ComponentStatus = status_fn(*args)
|
comp_status: ComponentStatus = status_fn(*args)
|
||||||
@@ -331,13 +333,19 @@ class UpdateMenu(BaseMenu):
|
|||||||
elif name == "moonraker":
|
elif name == "moonraker":
|
||||||
self._set_status_data("moonraker", get_moonraker_status)
|
self._set_status_data("moonraker", get_moonraker_status)
|
||||||
elif name == "mainsail":
|
elif name == "mainsail":
|
||||||
self._set_status_data("mainsail", get_client_status, self.mainsail_data, True)
|
self._set_status_data(
|
||||||
|
"mainsail", get_client_status, self.mainsail_data, True
|
||||||
|
)
|
||||||
elif name == "mainsail_config":
|
elif name == "mainsail_config":
|
||||||
self._set_status_data("mainsail_config", get_client_config_status, self.mainsail_data)
|
self._set_status_data(
|
||||||
|
"mainsail_config", get_client_config_status, self.mainsail_data
|
||||||
|
)
|
||||||
elif name == "fluidd":
|
elif name == "fluidd":
|
||||||
self._set_status_data("fluidd", get_client_status, self.fluidd_data, True)
|
self._set_status_data("fluidd", get_client_status, self.fluidd_data, True)
|
||||||
elif name == "fluidd_config":
|
elif name == "fluidd_config":
|
||||||
self._set_status_data("fluidd_config", get_client_config_status, self.fluidd_data)
|
self._set_status_data(
|
||||||
|
"fluidd_config", get_client_config_status, self.fluidd_data
|
||||||
|
)
|
||||||
elif name == "klipperscreen":
|
elif name == "klipperscreen":
|
||||||
self._set_status_data("klipperscreen", get_klipperscreen_status)
|
self._set_status_data("klipperscreen", get_klipperscreen_status)
|
||||||
elif name == "crowsnest":
|
elif name == "crowsnest":
|
||||||
@@ -362,6 +370,7 @@ class UpdateMenu(BaseMenu):
|
|||||||
|
|
||||||
Logger.print_status("Upgrading system packages ...")
|
Logger.print_status("Upgrading system packages ...")
|
||||||
|
|
||||||
|
with self.pause_loading():
|
||||||
upgrade_system_packages(self.packages)
|
upgrade_system_packages(self.packages)
|
||||||
self._fetch_system_package_update_status()
|
self._fetch_system_package_update_status()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, List
|
from typing import Any, List
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
# https://github.com/dw-0/kiauh #
|
# https://github.com/dw-0/kiauh #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2025 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2025 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -1,6 +1,11 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Tests: Verhalten beim Aktualisieren von Multiline-Optionen #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from core.simple_config_parser.simple_config_parser import (
|
from core.simple_config_parser.simple_config_parser import (
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -1,3 +1,12 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2026 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from core.simple_config_parser.simple_config_parser import Gcode, SimpleConfigParser
|
from core.simple_config_parser.simple_config_parser import Gcode, SimpleConfigParser
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from core.simple_config_parser.simple_config_parser import Section, SimpleConfigParser
|
from core.simple_config_parser.simple_config_parser import Section, SimpleConfigParser
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2024 Dominik Willner <dev.dw-0@proton.me> #
|
||||||
# #
|
# #
|
||||||
# https://github.com/dw-0/simple-config-parser #
|
# https://github.com/dw-0/simple-config-parser #
|
||||||
# #
|
# #
|
||||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user