mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 19:14:27 +05:00
Compare commits
31 Commits
v6.0.0-alp
...
v5.1.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fc36f3e68 | ||
|
|
a4942b9404 | ||
|
|
9e0a8a0081 | ||
|
|
6082528628 | ||
|
|
9e92e4a36a | ||
|
|
7e8f1f3d81 | ||
|
|
234cf2c751 | ||
|
|
3bc98eed13 | ||
|
|
777f5e45e7 | ||
|
|
acf0faf158 | ||
|
|
5c219ec544 | ||
|
|
70055e891e | ||
|
|
e3a0a9dec0 | ||
|
|
1cf81377ee | ||
|
|
aa4ea99c5c | ||
|
|
20ffc82a04 | ||
|
|
0becf9d574 | ||
|
|
ed1bfcdeb4 | ||
|
|
033916216c | ||
|
|
d8f47c0960 | ||
|
|
4978f22101 | ||
|
|
8330f90b56 | ||
|
|
2a08e3eb15 | ||
|
|
a2a3e92b50 | ||
|
|
a58288e7e3 | ||
|
|
3852464ab7 | ||
|
|
d9626adc98 | ||
|
|
4ae5a37ec6 | ||
|
|
935f81aab6 | ||
|
|
b02df9a1e0 | ||
|
|
dbbc87f18e |
2
kiauh.py
2
kiauh.py
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -27,7 +27,6 @@ from components.crowsnest import (
|
|||||||
)
|
)
|
||||||
from components.klipper.klipper import Klipper
|
from components.klipper.klipper import Klipper
|
||||||
from core.backup_manager.backup_manager import BackupManager
|
from core.backup_manager.backup_manager import BackupManager
|
||||||
from core.constants import CURRENT_USER
|
|
||||||
from core.logger import DialogType, Logger
|
from core.logger import DialogType, Logger
|
||||||
from core.settings.kiauh_settings import KiauhSettings
|
from core.settings.kiauh_settings import KiauhSettings
|
||||||
from core.types.component_status import ComponentStatus
|
from core.types.component_status import ComponentStatus
|
||||||
@@ -73,7 +72,7 @@ def install_crowsnest() -> None:
|
|||||||
Logger.print_info("Installer will prompt you for sudo password!")
|
Logger.print_info("Installer will prompt you for sudo password!")
|
||||||
try:
|
try:
|
||||||
run(
|
run(
|
||||||
f"sudo make install BASE_USER={CURRENT_USER}",
|
f"sudo make install",
|
||||||
cwd=CROWSNEST_DIR,
|
cwd=CROWSNEST_DIR,
|
||||||
shell=True,
|
shell=True,
|
||||||
check=True,
|
check=True,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -25,6 +25,7 @@ KLIPPER_SERVICE_NAME = "klipper.service"
|
|||||||
|
|
||||||
# directories
|
# directories
|
||||||
KLIPPER_DIR = Path.home().joinpath("klipper")
|
KLIPPER_DIR = Path.home().joinpath("klipper")
|
||||||
|
KLIPPER_KCONFIGS_DIR = Path.home().joinpath("klipper-kconfigs")
|
||||||
KLIPPER_ENV_DIR = Path.home().joinpath("klippy-env")
|
KLIPPER_ENV_DIR = Path.home().joinpath("klippy-env")
|
||||||
KLIPPER_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("klipper-backups")
|
KLIPPER_BACKUP_DIR = BACKUP_ROOT_DIR.joinpath("klipper-backups")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -176,6 +176,9 @@ def install_klipper_packages() -> None:
|
|||||||
script = KLIPPER_INSTALL_SCRIPT
|
script = KLIPPER_INSTALL_SCRIPT
|
||||||
packages = parse_packages_from_file(script)
|
packages = parse_packages_from_file(script)
|
||||||
|
|
||||||
|
# Add pkg-config for rp2040 build
|
||||||
|
packages.append("pkg-config")
|
||||||
|
|
||||||
# Add dbus requirement for DietPi distro
|
# Add dbus requirement for DietPi distro
|
||||||
if Path("/boot/dietpi/.version").exists():
|
if Path("/boot/dietpi/.version").exists():
|
||||||
packages.append("dbus")
|
packages.append("dbus")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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,6 +7,7 @@
|
|||||||
# 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 subprocess import (
|
from subprocess import (
|
||||||
DEVNULL,
|
DEVNULL,
|
||||||
PIPE,
|
PIPE,
|
||||||
@@ -138,6 +139,7 @@ def start_flash_process(flash_options: FlashOptions) -> None:
|
|||||||
if flash_options.flash_method is FlashMethod.REGULAR:
|
if flash_options.flash_method is FlashMethod.REGULAR:
|
||||||
cmd = [
|
cmd = [
|
||||||
"make",
|
"make",
|
||||||
|
f"KCONFIG_CONFIG={flash_options.selected_kconfig}",
|
||||||
flash_options.flash_command.value,
|
flash_options.flash_command.value,
|
||||||
f"FLASH_DEVICE={flash_options.selected_mcu}",
|
f"FLASH_DEVICE={flash_options.selected_mcu}",
|
||||||
]
|
]
|
||||||
@@ -165,17 +167,17 @@ def start_flash_process(flash_options: FlashOptions) -> None:
|
|||||||
if rc != 0:
|
if rc != 0:
|
||||||
raise Exception(f"Flashing failed with returncode: {rc}")
|
raise Exception(f"Flashing failed with returncode: {rc}")
|
||||||
else:
|
else:
|
||||||
Logger.print_ok("Flashing successfull!", start="\n", end="\n\n")
|
Logger.print_ok("Flashing successful!", start="\n", end="\n\n")
|
||||||
|
|
||||||
except (Exception, CalledProcessError):
|
except (Exception, CalledProcessError):
|
||||||
Logger.print_error("Flashing failed!", start="\n")
|
Logger.print_error("Flashing failed!", start="\n")
|
||||||
Logger.print_error("See the console output above!", end="\n\n")
|
Logger.print_error("See the console output above!", end="\n\n")
|
||||||
|
|
||||||
|
|
||||||
def run_make_clean() -> None:
|
def run_make_clean(kconfig=Path(KLIPPER_DIR.joinpath(".config"))) -> None:
|
||||||
try:
|
try:
|
||||||
run(
|
run(
|
||||||
"make clean",
|
f"make KCONFIG_CONFIG={kconfig} clean",
|
||||||
cwd=KLIPPER_DIR,
|
cwd=KLIPPER_DIR,
|
||||||
shell=True,
|
shell=True,
|
||||||
check=True,
|
check=True,
|
||||||
@@ -185,10 +187,10 @@ def run_make_clean() -> None:
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def run_make_menuconfig() -> None:
|
def run_make_menuconfig(kconfig=Path(KLIPPER_DIR.joinpath(".config"))) -> None:
|
||||||
try:
|
try:
|
||||||
run(
|
run(
|
||||||
"make PYTHON=python3 menuconfig",
|
f"make PYTHON=python3 KCONFIG_CONFIG={kconfig} menuconfig",
|
||||||
cwd=KLIPPER_DIR,
|
cwd=KLIPPER_DIR,
|
||||||
shell=True,
|
shell=True,
|
||||||
check=True,
|
check=True,
|
||||||
@@ -198,10 +200,10 @@ def run_make_menuconfig() -> None:
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def run_make() -> None:
|
def run_make(kconfig=Path(KLIPPER_DIR.joinpath(".config"))) -> None:
|
||||||
try:
|
try:
|
||||||
run(
|
run(
|
||||||
"make PYTHON=python3",
|
f"make PYTHON=python3 KCONFIG_CONFIG={kconfig}",
|
||||||
cwd=KLIPPER_DIR,
|
cwd=KLIPPER_DIR,
|
||||||
shell=True,
|
shell=True,
|
||||||
check=True,
|
check=True,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -39,6 +39,7 @@ class FlashOptions:
|
|||||||
_selected_mcu: str = ""
|
_selected_mcu: str = ""
|
||||||
_selected_board: str = ""
|
_selected_board: str = ""
|
||||||
_selected_baudrate: int = 250000
|
_selected_baudrate: int = 250000
|
||||||
|
_selected_kconfig: str = ".config"
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
if not cls._instance:
|
if not cls._instance:
|
||||||
@@ -104,3 +105,11 @@ class FlashOptions:
|
|||||||
@selected_baudrate.setter
|
@selected_baudrate.setter
|
||||||
def selected_baudrate(self, value: int) -> None:
|
def selected_baudrate(self, value: int) -> None:
|
||||||
self._selected_baudrate = value
|
self._selected_baudrate = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def selected_kconfig(self) -> str:
|
||||||
|
return self._selected_kconfig
|
||||||
|
|
||||||
|
@selected_kconfig.setter
|
||||||
|
def selected_kconfig(self, value: str) -> None:
|
||||||
|
self._selected_kconfig = value
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -9,18 +9,22 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
|
from pathlib import Path
|
||||||
|
from shutil import copyfile
|
||||||
from typing import List, Set, Type
|
from typing import List, Set, Type
|
||||||
|
|
||||||
from components.klipper import KLIPPER_DIR
|
from components.klipper import KLIPPER_DIR, KLIPPER_KCONFIGS_DIR
|
||||||
from components.klipper_firmware.firmware_utils import (
|
from components.klipper_firmware.firmware_utils import (
|
||||||
run_make,
|
run_make,
|
||||||
run_make_clean,
|
run_make_clean,
|
||||||
run_make_menuconfig,
|
run_make_menuconfig,
|
||||||
)
|
)
|
||||||
from core.logger import Logger
|
from components.klipper_firmware.flash_options import FlashOptions
|
||||||
|
from core.logger import DialogType, Logger
|
||||||
from core.menus import Option
|
from core.menus import Option
|
||||||
from core.menus.base_menu import BaseMenu
|
from core.menus.base_menu import BaseMenu
|
||||||
from core.types.color import Color
|
from core.types.color import Color
|
||||||
|
from utils.input_utils import get_confirm, get_string_input
|
||||||
from utils.sys_utils import (
|
from utils.sys_utils import (
|
||||||
check_package_install,
|
check_package_install,
|
||||||
install_system_packages,
|
install_system_packages,
|
||||||
@@ -30,14 +34,25 @@ from utils.sys_utils import (
|
|||||||
|
|
||||||
# noinspection PyUnusedLocal
|
# noinspection PyUnusedLocal
|
||||||
# noinspection PyMethodMayBeStatic
|
# noinspection PyMethodMayBeStatic
|
||||||
class KlipperBuildFirmwareMenu(BaseMenu):
|
class KlipperKConfigMenu(BaseMenu):
|
||||||
def __init__(self, previous_menu: Type[BaseMenu] | None = None):
|
def __init__(self, previous_menu: Type[BaseMenu] | None = None):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.title = "Build Firmware Menu"
|
self.title = "Firmware Config Menu"
|
||||||
self.title_color = Color.CYAN
|
self.title_color = Color.CYAN
|
||||||
self.previous_menu: Type[BaseMenu] | None = previous_menu
|
self.previous_menu: Type[BaseMenu] | None = previous_menu
|
||||||
self.deps: Set[str] = {"build-essential", "dpkg-dev", "make"}
|
self.flash_options = FlashOptions()
|
||||||
self.missing_deps: List[str] = check_package_install(self.deps)
|
self.kconfigs_dirname = KLIPPER_KCONFIGS_DIR
|
||||||
|
self.kconfig_default = KLIPPER_DIR.joinpath(".config")
|
||||||
|
self.configs: List[Path] = []
|
||||||
|
self.kconfig = (
|
||||||
|
self.kconfig_default if not Path(self.kconfigs_dirname).is_dir() else None
|
||||||
|
)
|
||||||
|
|
||||||
|
def run(self) -> None:
|
||||||
|
if not self.kconfig:
|
||||||
|
super().run()
|
||||||
|
else:
|
||||||
|
self.flash_options.selected_kconfig = self.kconfig
|
||||||
|
|
||||||
def set_previous_menu(self, previous_menu: Type[BaseMenu] | None) -> None:
|
def set_previous_menu(self, previous_menu: Type[BaseMenu] | None) -> None:
|
||||||
from core.menus.advanced_menu import AdvancedMenu
|
from core.menus.advanced_menu import AdvancedMenu
|
||||||
@@ -47,16 +62,107 @@ class KlipperBuildFirmwareMenu(BaseMenu):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def set_options(self) -> None:
|
def set_options(self) -> None:
|
||||||
if len(self.missing_deps) == 0:
|
if not Path(self.kconfigs_dirname).is_dir():
|
||||||
self.input_label_txt = "Press ENTER to continue"
|
return
|
||||||
self.default_option = Option(method=self.start_build_process)
|
|
||||||
else:
|
self.input_label_txt = "Select config or action to continue (default=N)"
|
||||||
self.input_label_txt = "Press ENTER to install dependencies"
|
self.default_option = Option(
|
||||||
self.default_option = Option(method=self.install_missing_deps)
|
method=self.select_config, opt_data=self.kconfig_default
|
||||||
|
)
|
||||||
|
|
||||||
|
option_index = 1
|
||||||
|
for kconfig in Path(self.kconfigs_dirname).iterdir():
|
||||||
|
if not kconfig.name.endswith(".config"):
|
||||||
|
continue
|
||||||
|
kconfig_path = self.kconfigs_dirname.joinpath(kconfig)
|
||||||
|
if Path(kconfig_path).is_file():
|
||||||
|
self.configs += [kconfig]
|
||||||
|
self.options[str(option_index)] = Option(
|
||||||
|
method=self.select_config, opt_data=kconfig_path
|
||||||
|
)
|
||||||
|
option_index += 1
|
||||||
|
self.options["n"] = Option(
|
||||||
|
method=self.select_config, opt_data=self.kconfig_default
|
||||||
|
)
|
||||||
|
|
||||||
def print_menu(self) -> None:
|
def print_menu(self) -> None:
|
||||||
|
cfg_found_str = Color.apply(
|
||||||
|
"Previously saved firmware configs found!", Color.GREEN
|
||||||
|
)
|
||||||
menu = textwrap.dedent(
|
menu = textwrap.dedent(
|
||||||
|
f"""
|
||||||
|
╟───────────────────────────────────────────────────────╢
|
||||||
|
║ {cfg_found_str:^62} ║
|
||||||
|
║ ║
|
||||||
|
║ Select an existing config or create a new one. ║
|
||||||
|
╟───────────────────────────────────────────────────────╢
|
||||||
|
║ Available firmware configs: ║
|
||||||
"""
|
"""
|
||||||
|
)[1:]
|
||||||
|
|
||||||
|
start_index = 1
|
||||||
|
for i, s in enumerate(self.configs):
|
||||||
|
line = f"{start_index + i}) {s.name}"
|
||||||
|
menu += f"║ {line:<54}║\n"
|
||||||
|
|
||||||
|
new_config = Color.apply("N) Create new firmware config", Color.GREEN)
|
||||||
|
menu += "║ ║\n"
|
||||||
|
menu += f"║ {new_config:<62} ║\n"
|
||||||
|
|
||||||
|
menu += "╟───────────────────────────────────────────────────────╢\n"
|
||||||
|
|
||||||
|
print(menu, end="")
|
||||||
|
|
||||||
|
def select_config(self, **kwargs) -> None:
|
||||||
|
selection: str | None = kwargs.get("opt_data", None)
|
||||||
|
if selection is None:
|
||||||
|
raise Exception("opt_data is None")
|
||||||
|
if not Path(selection).is_file() and selection != self.kconfig_default:
|
||||||
|
raise Exception("opt_data does not exists")
|
||||||
|
self.kconfig = selection
|
||||||
|
|
||||||
|
|
||||||
|
# noinspection PyUnusedLocal
|
||||||
|
# noinspection PyMethodMayBeStatic
|
||||||
|
class KlipperBuildFirmwareMenu(BaseMenu):
|
||||||
|
def __init__(
|
||||||
|
self, kconfig: str | None = None, previous_menu: Type[BaseMenu] | None = None
|
||||||
|
):
|
||||||
|
super().__init__()
|
||||||
|
self.title = "Build Firmware Menu"
|
||||||
|
self.title_color = Color.CYAN
|
||||||
|
self.previous_menu: Type[BaseMenu] | None = previous_menu
|
||||||
|
self.deps: Set[str] = {"build-essential", "dpkg-dev", "make"}
|
||||||
|
self.missing_deps: List[str] = check_package_install(self.deps)
|
||||||
|
self.flash_options = FlashOptions()
|
||||||
|
self.kconfigs_dirname = KLIPPER_KCONFIGS_DIR
|
||||||
|
self.kconfig_default = KLIPPER_DIR.joinpath(".config")
|
||||||
|
self.kconfig = self.flash_options.selected_kconfig
|
||||||
|
|
||||||
|
def set_previous_menu(self, previous_menu: Type[BaseMenu] | None) -> None:
|
||||||
|
from core.menus.advanced_menu import AdvancedMenu
|
||||||
|
|
||||||
|
self.previous_menu = (
|
||||||
|
previous_menu if previous_menu is not None else AdvancedMenu
|
||||||
|
)
|
||||||
|
|
||||||
|
def set_options(self) -> None:
|
||||||
|
self.input_label_txt = "Press ENTER to install dependencies"
|
||||||
|
self.default_option = Option(method=self.install_missing_deps)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
# immediately start the build process if all dependencies are met
|
||||||
|
if len(self.missing_deps) == 0:
|
||||||
|
self.start_build_process()
|
||||||
|
else:
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
def print_menu(self) -> None:
|
||||||
|
txt = Color.apply("Dependencies are missing!", Color.RED)
|
||||||
|
menu = textwrap.dedent(
|
||||||
|
f"""
|
||||||
|
╟───────────────────────────────────────────────────────╢
|
||||||
|
║ {txt:^62} ║
|
||||||
╟───────────────────────────────────────────────────────╢
|
╟───────────────────────────────────────────────────────╢
|
||||||
║ The following dependencies are required: ║
|
║ The following dependencies are required: ║
|
||||||
║ ║
|
║ ║
|
||||||
@@ -67,19 +173,11 @@ class KlipperBuildFirmwareMenu(BaseMenu):
|
|||||||
status_ok = Color.apply("*INSTALLED*", Color.GREEN)
|
status_ok = Color.apply("*INSTALLED*", Color.GREEN)
|
||||||
status_missing = Color.apply("*MISSING*", Color.RED)
|
status_missing = Color.apply("*MISSING*", Color.RED)
|
||||||
status = status_missing if d in self.missing_deps else status_ok
|
status = status_missing if d in self.missing_deps else status_ok
|
||||||
padding = 39 - len(d) + len(status) + (len(status_ok) - len(status))
|
padding = 40 - len(d) + len(status) + (len(status_ok) - len(status))
|
||||||
d = Color.apply(f"● {d}", Color.CYAN)
|
d = Color.apply(f"● {d}", Color.CYAN)
|
||||||
menu += f"║ {d}{status:>{padding}} ║\n"
|
menu += f"║ {d}{status:>{padding}} ║\n"
|
||||||
|
|
||||||
menu += "║ ║\n"
|
menu += "║ ║\n"
|
||||||
|
|
||||||
color = Color.GREEN if len(self.missing_deps) == 0 else Color.RED
|
|
||||||
txt = (
|
|
||||||
"All dependencies are met!"
|
|
||||||
if len(self.missing_deps) == 0
|
|
||||||
else "Dependencies are missing!"
|
|
||||||
)
|
|
||||||
|
|
||||||
menu += f"║ {Color.apply(txt, color):<62} ║\n"
|
|
||||||
menu += "╟───────────────────────────────────────────────────────╢\n"
|
menu += "╟───────────────────────────────────────────────────────╢\n"
|
||||||
|
|
||||||
print(menu, end="")
|
print(menu, end="")
|
||||||
@@ -98,13 +196,16 @@ class KlipperBuildFirmwareMenu(BaseMenu):
|
|||||||
|
|
||||||
def start_build_process(self, **kwargs) -> None:
|
def start_build_process(self, **kwargs) -> None:
|
||||||
try:
|
try:
|
||||||
run_make_clean()
|
run_make_clean(self.kconfig)
|
||||||
run_make_menuconfig()
|
run_make_menuconfig(self.kconfig)
|
||||||
run_make()
|
run_make(self.kconfig)
|
||||||
|
|
||||||
Logger.print_ok("Firmware successfully built!")
|
Logger.print_ok("Firmware successfully built!")
|
||||||
Logger.print_ok(f"Firmware file located in '{KLIPPER_DIR}/out'!")
|
Logger.print_ok(f"Firmware file located in '{KLIPPER_DIR}/out'!")
|
||||||
|
|
||||||
|
if self.kconfig == self.kconfig_default:
|
||||||
|
self.save_firmware_config()
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Logger.print_error(e)
|
Logger.print_error(e)
|
||||||
Logger.print_error("Building Klipper Firmware failed!")
|
Logger.print_error("Building Klipper Firmware failed!")
|
||||||
@@ -112,3 +213,62 @@ class KlipperBuildFirmwareMenu(BaseMenu):
|
|||||||
finally:
|
finally:
|
||||||
if self.previous_menu is not None:
|
if self.previous_menu is not None:
|
||||||
self.previous_menu().run()
|
self.previous_menu().run()
|
||||||
|
|
||||||
|
def save_firmware_config(self) -> None:
|
||||||
|
Logger.print_dialog(
|
||||||
|
DialogType.CUSTOM,
|
||||||
|
[
|
||||||
|
"You can save the firmware build configs for multiple MCUs,"
|
||||||
|
" and use them to update the firmware after a Klipper version upgrade"
|
||||||
|
],
|
||||||
|
custom_title="Save firmware config",
|
||||||
|
)
|
||||||
|
if not get_confirm(
|
||||||
|
"Do you want to save firmware config?", default_choice=False
|
||||||
|
):
|
||||||
|
return
|
||||||
|
|
||||||
|
filename = self.kconfig_default
|
||||||
|
while True:
|
||||||
|
Logger.print_dialog(
|
||||||
|
DialogType.CUSTOM,
|
||||||
|
[
|
||||||
|
"Allowed characters: a-z, 0-9 and '-'",
|
||||||
|
"The name must not contain the following:",
|
||||||
|
"\n\n",
|
||||||
|
"● Any special characters",
|
||||||
|
"● No leading or trailing '-'",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
input_name = get_string_input(
|
||||||
|
"Enter the new firmware config name",
|
||||||
|
regex=r"^[a-z0-9]+([a-z0-9-]*[a-z0-9])?$",
|
||||||
|
)
|
||||||
|
filename = self.kconfigs_dirname.joinpath(f"{input_name}.config")
|
||||||
|
|
||||||
|
if Path(filename).is_file():
|
||||||
|
if get_confirm(
|
||||||
|
f"Firmware config {input_name} already exists, overwrite?",
|
||||||
|
default_choice=False,
|
||||||
|
):
|
||||||
|
break
|
||||||
|
|
||||||
|
if Path(filename).is_dir():
|
||||||
|
Logger.print_error(f"Path {filename} exists and it's a directory")
|
||||||
|
|
||||||
|
if not Path(filename).exists():
|
||||||
|
break
|
||||||
|
|
||||||
|
if not get_confirm(
|
||||||
|
f"Save firmware config to '{filename}'?", default_choice=True
|
||||||
|
):
|
||||||
|
Logger.print_info("Aborted saving firmware config ...")
|
||||||
|
return
|
||||||
|
|
||||||
|
if not Path(self.kconfigs_dirname).exists():
|
||||||
|
Path(self.kconfigs_dirname).mkdir()
|
||||||
|
|
||||||
|
copyfile(self.kconfig_default, filename)
|
||||||
|
|
||||||
|
Logger.print_ok()
|
||||||
|
Logger.print_ok(f"Firmware config successfully saved to {filename}")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -10,6 +10,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
|
from pathlib import Path
|
||||||
from typing import Type
|
from typing import Type
|
||||||
|
|
||||||
from components.klipper_firmware.firmware_utils import (
|
from components.klipper_firmware.firmware_utils import (
|
||||||
@@ -420,6 +421,7 @@ class KlipperFlashOverviewMenu(BaseMenu):
|
|||||||
mcu = self.flash_options.selected_mcu.split("/")[-1]
|
mcu = self.flash_options.selected_mcu.split("/")[-1]
|
||||||
board = self.flash_options.selected_board
|
board = self.flash_options.selected_board
|
||||||
baudrate = self.flash_options.selected_baudrate
|
baudrate = self.flash_options.selected_baudrate
|
||||||
|
kconfig = Path(self.flash_options.selected_kconfig).name
|
||||||
color = Color.CYAN
|
color = Color.CYAN
|
||||||
subheader = f"[{Color.apply('Overview', color)}]"
|
subheader = f"[{Color.apply('Overview', color)}]"
|
||||||
menu = textwrap.dedent(
|
menu = textwrap.dedent(
|
||||||
@@ -452,6 +454,13 @@ class KlipperFlashOverviewMenu(BaseMenu):
|
|||||||
"""
|
"""
|
||||||
)[1:]
|
)[1:]
|
||||||
|
|
||||||
|
if self.flash_options.flash_method is FlashMethod.REGULAR:
|
||||||
|
menu += textwrap.dedent(
|
||||||
|
f"""
|
||||||
|
║ Firmware config: {Color.apply(f"{kconfig:<36}", color)} ║
|
||||||
|
"""
|
||||||
|
)[1:]
|
||||||
|
|
||||||
menu += textwrap.dedent(
|
menu += textwrap.dedent(
|
||||||
"""
|
"""
|
||||||
║ ║
|
║ ║
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ trusted_clients:
|
|||||||
169.254.0.0/16
|
169.254.0.0/16
|
||||||
172.16.0.0/12
|
172.16.0.0/12
|
||||||
192.168.0.0/16
|
192.168.0.0/16
|
||||||
|
FC00::/7
|
||||||
FE80::/10
|
FE80::/10
|
||||||
::1/128
|
::1/128
|
||||||
cors_domains:
|
cors_domains:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
@@ -28,9 +27,14 @@ from components.moonraker import (
|
|||||||
)
|
)
|
||||||
from components.moonraker.moonraker import Moonraker
|
from components.moonraker.moonraker import Moonraker
|
||||||
from components.moonraker.moonraker_dialogs import print_moonraker_overview
|
from components.moonraker.moonraker_dialogs import print_moonraker_overview
|
||||||
from components.moonraker.moonraker_utils import (
|
from components.moonraker.services.moonraker_instance_service import (
|
||||||
|
MoonrakerInstanceService,
|
||||||
|
)
|
||||||
|
from components.moonraker.utils.sysdeps_parser import SysDepsParser
|
||||||
|
from components.moonraker.utils.utils import (
|
||||||
backup_moonraker_dir,
|
backup_moonraker_dir,
|
||||||
create_example_moonraker_conf,
|
create_example_moonraker_conf,
|
||||||
|
load_sysdeps_json,
|
||||||
)
|
)
|
||||||
from components.webui_client.client_utils import (
|
from components.webui_client.client_utils import (
|
||||||
enable_mainsail_remotemode,
|
enable_mainsail_remotemode,
|
||||||
@@ -38,8 +42,9 @@ from components.webui_client.client_utils import (
|
|||||||
)
|
)
|
||||||
from components.webui_client.mainsail_data import MainsailData
|
from components.webui_client.mainsail_data import MainsailData
|
||||||
from core.instance_manager.instance_manager import InstanceManager
|
from core.instance_manager.instance_manager import InstanceManager
|
||||||
from core.logger import Logger
|
from core.logger import DialogType, Logger
|
||||||
from core.settings.kiauh_settings import KiauhSettings
|
from core.settings.kiauh_settings import KiauhSettings
|
||||||
|
from core.types.color import Color
|
||||||
from utils.common import check_install_dependencies
|
from utils.common import check_install_dependencies
|
||||||
from utils.fs_utils import check_file_exist
|
from utils.fs_utils import check_file_exist
|
||||||
from utils.git_utils import git_clone_wrapper, git_pull_wrapper
|
from utils.git_utils import git_clone_wrapper, git_pull_wrapper
|
||||||
@@ -53,6 +58,7 @@ from utils.sys_utils import (
|
|||||||
cmd_sysctl_manage,
|
cmd_sysctl_manage,
|
||||||
cmd_sysctl_service,
|
cmd_sysctl_service,
|
||||||
create_python_venv,
|
create_python_venv,
|
||||||
|
get_ipv4_addr,
|
||||||
install_python_requirements,
|
install_python_requirements,
|
||||||
parse_packages_from_file,
|
parse_packages_from_file,
|
||||||
)
|
)
|
||||||
@@ -64,12 +70,18 @@ def install_moonraker() -> None:
|
|||||||
if not check_moonraker_install_requirements(klipper_list):
|
if not check_moonraker_install_requirements(klipper_list):
|
||||||
return
|
return
|
||||||
|
|
||||||
moonraker_list: List[Moonraker] = get_instances(Moonraker)
|
instance_service = MoonrakerInstanceService()
|
||||||
instances: List[Moonraker] = []
|
instance_service.load_instances()
|
||||||
|
|
||||||
|
moonraker_list: List[Moonraker] = instance_service.get_all_instances()
|
||||||
|
new_instances: List[Moonraker] = []
|
||||||
selected_option: str | Klipper
|
selected_option: str | Klipper
|
||||||
|
|
||||||
if len(klipper_list) == 1:
|
if len(klipper_list) == 1:
|
||||||
instances.append(Moonraker(klipper_list[0].suffix))
|
suffix: str = klipper_list[0].suffix
|
||||||
|
new_inst = instance_service.create_new_instance(suffix)
|
||||||
|
new_instances.append(new_inst)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print_moonraker_overview(
|
print_moonraker_overview(
|
||||||
klipper_list,
|
klipper_list,
|
||||||
@@ -88,12 +100,15 @@ def install_moonraker() -> None:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if selected_option == "a":
|
if selected_option == "a":
|
||||||
instances.extend([Moonraker(k.suffix) for k in klipper_list])
|
new_inst_list: List[Moonraker] = (
|
||||||
|
[instance_service.create_new_instance(k.suffix) for k in klipper_list])
|
||||||
|
new_instances.extend(new_inst_list)
|
||||||
else:
|
else:
|
||||||
klipper_instance: Klipper | None = options.get(selected_option)
|
klipper_instance: Klipper | None = options.get(selected_option)
|
||||||
if klipper_instance is None:
|
if klipper_instance is None:
|
||||||
raise Exception("Error selecting instance!")
|
raise Exception("Error selecting instance!")
|
||||||
instances.append(Moonraker(klipper_instance.suffix))
|
new_inst = instance_service.create_new_instance(klipper_instance.suffix)
|
||||||
|
new_instances.append(new_inst)
|
||||||
|
|
||||||
create_example_cfg = get_confirm("Create example moonraker.conf?")
|
create_example_cfg = get_confirm("Create example moonraker.conf?")
|
||||||
|
|
||||||
@@ -102,8 +117,8 @@ def install_moonraker() -> None:
|
|||||||
setup_moonraker_prerequesites()
|
setup_moonraker_prerequesites()
|
||||||
install_moonraker_polkit()
|
install_moonraker_polkit()
|
||||||
|
|
||||||
used_ports_map = {m.suffix: m.port for m in moonraker_list}
|
ports_map = instance_service.get_instance_port_map()
|
||||||
for instance in instances:
|
for instance in new_instances:
|
||||||
instance.create()
|
instance.create()
|
||||||
cmd_sysctl_service(instance.service_file_path.name, "enable")
|
cmd_sysctl_service(instance.service_file_path.name, "enable")
|
||||||
|
|
||||||
@@ -111,7 +126,7 @@ def install_moonraker() -> None:
|
|||||||
# if a webclient and/or it's config is installed, patch
|
# if a webclient and/or it's config is installed, patch
|
||||||
# its update section to the config
|
# its update section to the config
|
||||||
clients = get_existing_clients()
|
clients = get_existing_clients()
|
||||||
create_example_moonraker_conf(instance, used_ports_map, clients)
|
create_example_moonraker_conf(instance, ports_map, clients)
|
||||||
|
|
||||||
cmd_sysctl_service(instance.service_file_path.name, "start")
|
cmd_sysctl_service(instance.service_file_path.name, "start")
|
||||||
|
|
||||||
@@ -122,6 +137,26 @@ def install_moonraker() -> None:
|
|||||||
if MainsailData().client_dir.exists() and len(moonraker_list) > 1:
|
if MainsailData().client_dir.exists() and len(moonraker_list) > 1:
|
||||||
enable_mainsail_remotemode()
|
enable_mainsail_remotemode()
|
||||||
|
|
||||||
|
instance_service.load_instances()
|
||||||
|
new_instances = [instance_service.get_instance_by_suffix(i.suffix) for i in
|
||||||
|
new_instances]
|
||||||
|
|
||||||
|
ip: str = get_ipv4_addr()
|
||||||
|
# noinspection HttpUrlsUsage
|
||||||
|
url_list = [f"● {i.service_file_path.stem}: http://{ip}:{i.port}" for i in
|
||||||
|
new_instances if i.port]
|
||||||
|
dialog_content = []
|
||||||
|
if url_list:
|
||||||
|
dialog_content.append("You can access Moonraker via the following URL:")
|
||||||
|
dialog_content.extend(url_list)
|
||||||
|
|
||||||
|
Logger.print_dialog(
|
||||||
|
DialogType.CUSTOM,
|
||||||
|
custom_title="Moonraker successfully installed!",
|
||||||
|
custom_color=Color.GREEN,
|
||||||
|
content=dialog_content)
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Logger.print_error(f"Error while installing Moonraker: {e}")
|
Logger.print_error(f"Error while installing Moonraker: {e}")
|
||||||
return
|
return
|
||||||
@@ -154,16 +189,24 @@ def setup_moonraker_prerequesites() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def install_moonraker_packages() -> None:
|
def install_moonraker_packages() -> None:
|
||||||
moonraker_deps = []
|
Logger.print_status("Parsing Moonraker system dependencies ...")
|
||||||
|
|
||||||
|
moonraker_deps = []
|
||||||
if MOONRAKER_DEPS_JSON_FILE.exists():
|
if MOONRAKER_DEPS_JSON_FILE.exists():
|
||||||
with open(MOONRAKER_DEPS_JSON_FILE, "r") as deps:
|
Logger.print_info(
|
||||||
moonraker_deps = json.load(deps).get("debian", [])
|
f"Parsing system dependencies from {MOONRAKER_DEPS_JSON_FILE.name} ...")
|
||||||
|
parser = SysDepsParser()
|
||||||
|
sysdeps = load_sysdeps_json(MOONRAKER_DEPS_JSON_FILE)
|
||||||
|
moonraker_deps.extend(parser.parse_dependencies(sysdeps))
|
||||||
|
|
||||||
elif MOONRAKER_INSTALL_SCRIPT.exists():
|
elif MOONRAKER_INSTALL_SCRIPT.exists():
|
||||||
|
Logger.print_warn(f"{MOONRAKER_DEPS_JSON_FILE.name} not found!")
|
||||||
|
Logger.print_info(
|
||||||
|
f"Parsing system dependencies from {MOONRAKER_INSTALL_SCRIPT.name} ...")
|
||||||
moonraker_deps = parse_packages_from_file(MOONRAKER_INSTALL_SCRIPT)
|
moonraker_deps = parse_packages_from_file(MOONRAKER_INSTALL_SCRIPT)
|
||||||
|
|
||||||
if not moonraker_deps:
|
if not moonraker_deps:
|
||||||
raise ValueError("Error reading Moonraker dependencies!")
|
raise ValueError("Error parsing Moonraker dependencies!")
|
||||||
|
|
||||||
check_install_dependencies({*moonraker_deps})
|
check_install_dependencies({*moonraker_deps})
|
||||||
|
|
||||||
|
|||||||
0
kiauh/components/moonraker/services/__init__.py
Normal file
0
kiauh/components/moonraker/services/__init__.py
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Dict, List
|
||||||
|
|
||||||
|
from components.moonraker.moonraker import Moonraker
|
||||||
|
from utils.instance_utils import get_instances
|
||||||
|
|
||||||
|
|
||||||
|
class MoonrakerInstanceService:
|
||||||
|
__cls_instance = None
|
||||||
|
__instances: List[Moonraker] = []
|
||||||
|
|
||||||
|
def __new__(cls) -> "MoonrakerInstanceService":
|
||||||
|
if cls.__cls_instance is None:
|
||||||
|
cls.__cls_instance = super(MoonrakerInstanceService, cls).__new__(cls)
|
||||||
|
return cls.__cls_instance
|
||||||
|
|
||||||
|
def __init__(self) -> None:
|
||||||
|
if not hasattr(self, "__initialized"):
|
||||||
|
self.__initialized = False
|
||||||
|
if self.__initialized:
|
||||||
|
return
|
||||||
|
self.__initialized = True
|
||||||
|
|
||||||
|
def load_instances(self) -> None:
|
||||||
|
self.__instances = get_instances(Moonraker)
|
||||||
|
|
||||||
|
def create_new_instance(self, suffix: str) -> Moonraker:
|
||||||
|
instance = Moonraker(suffix)
|
||||||
|
self.__instances.append(instance)
|
||||||
|
return instance
|
||||||
|
|
||||||
|
def get_all_instances(self) -> List[Moonraker]:
|
||||||
|
return self.__instances
|
||||||
|
|
||||||
|
def get_instance_by_suffix(self, suffix: str) -> Moonraker | None:
|
||||||
|
instances: List[Moonraker] = [i for i in self.__instances if i.suffix == suffix]
|
||||||
|
return instances[0] if instances else None
|
||||||
|
|
||||||
|
def get_instance_port_map(self) -> Dict[str, int]:
|
||||||
|
return {i.suffix: i.port for i in self.__instances}
|
||||||
0
kiauh/components/moonraker/utils/__init__.py
Normal file
0
kiauh/components/moonraker/utils/__init__.py
Normal file
167
kiauh/components/moonraker/utils/sysdeps_parser.py
Normal file
167
kiauh/components/moonraker/utils/sysdeps_parser.py
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
# ======================================================================= #
|
||||||
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
|
# #
|
||||||
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||||
|
# https://github.com/dw-0/kiauh #
|
||||||
|
# It was modified by Dominik Willner <th33xitus@gmail.com> #
|
||||||
|
# #
|
||||||
|
# The original file is part of Moonraker: #
|
||||||
|
# https://github.com/Arksine/moonraker #
|
||||||
|
# Copyright (C) 2025 Eric Callahan <arksine.code@gmail.com> #
|
||||||
|
# #
|
||||||
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||||
|
# ======================================================================= #
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
|
import pathlib
|
||||||
|
import re
|
||||||
|
import shlex
|
||||||
|
from typing import Any, Dict, List, Tuple
|
||||||
|
|
||||||
|
|
||||||
|
def _get_distro_info() -> Dict[str, Any]:
|
||||||
|
release_file = pathlib.Path("/etc/os-release")
|
||||||
|
release_info: Dict[str, str] = {}
|
||||||
|
with release_file.open("r") as f:
|
||||||
|
lexer = shlex.shlex(f, posix=True)
|
||||||
|
lexer.whitespace_split = True
|
||||||
|
for item in list(lexer):
|
||||||
|
if "=" in item:
|
||||||
|
key, val = item.split("=", maxsplit=1)
|
||||||
|
release_info[key] = val
|
||||||
|
return dict(
|
||||||
|
distro_id=release_info.get("ID", ""),
|
||||||
|
distro_version=release_info.get("VERSION_ID", ""),
|
||||||
|
aliases=release_info.get("ID_LIKE", "").split()
|
||||||
|
)
|
||||||
|
|
||||||
|
def _convert_version(version: str) -> Tuple[str | int, ...]:
|
||||||
|
version = version.strip()
|
||||||
|
ver_match = re.match(r"\d+(\.\d+)*((?:-|\.).+)?", version)
|
||||||
|
if ver_match is not None:
|
||||||
|
return tuple([
|
||||||
|
int(part) if part.isdigit() else part
|
||||||
|
for part in re.split(r"\.|-", version)
|
||||||
|
])
|
||||||
|
return (version,)
|
||||||
|
|
||||||
|
class SysDepsParser:
|
||||||
|
def __init__(self, distro_info: Dict[str, Any] | None = None) -> None:
|
||||||
|
if distro_info is None:
|
||||||
|
distro_info = _get_distro_info()
|
||||||
|
self.distro_id: str = distro_info.get("distro_id", "")
|
||||||
|
self.aliases: List[str] = distro_info.get("aliases", [])
|
||||||
|
self.distro_version: Tuple[int | str, ...] = tuple()
|
||||||
|
version = distro_info.get("distro_version")
|
||||||
|
if version:
|
||||||
|
self.distro_version = _convert_version(version)
|
||||||
|
|
||||||
|
def _parse_spec(self, full_spec: str) -> str | None:
|
||||||
|
parts = full_spec.split(";", maxsplit=1)
|
||||||
|
if len(parts) == 1:
|
||||||
|
return full_spec
|
||||||
|
pkg_name = parts[0].strip()
|
||||||
|
expressions = re.split(r"( and | or )", parts[1].strip())
|
||||||
|
if not len(expressions) & 1:
|
||||||
|
# There should always be an odd number of expressions. Each
|
||||||
|
# expression is separated by an "and" or "or" operator
|
||||||
|
logging.info(
|
||||||
|
f"Requirement specifier is missing an expression "
|
||||||
|
f"between logical operators : {full_spec}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
last_result: bool = True
|
||||||
|
last_logical_op: str | None = "and"
|
||||||
|
for idx, exp in enumerate(expressions):
|
||||||
|
if idx & 1:
|
||||||
|
if last_logical_op is not None:
|
||||||
|
logging.info(
|
||||||
|
"Requirement specifier contains sequential logical "
|
||||||
|
f"operators: {full_spec}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
logical_op = exp.strip()
|
||||||
|
if logical_op not in ("and", "or"):
|
||||||
|
logging.info(
|
||||||
|
f"Invalid logical operator {logical_op} in requirement "
|
||||||
|
f"specifier: {full_spec}")
|
||||||
|
return None
|
||||||
|
last_logical_op = logical_op
|
||||||
|
continue
|
||||||
|
elif last_logical_op is None:
|
||||||
|
logging.info(
|
||||||
|
f"Requirement specifier contains two seqential expressions "
|
||||||
|
f"without a logical operator: {full_spec}")
|
||||||
|
return None
|
||||||
|
dep_parts = re.split(r"(==|!=|<=|>=|<|>)", exp.strip())
|
||||||
|
req_var = dep_parts[0].strip().lower()
|
||||||
|
if len(dep_parts) != 3:
|
||||||
|
logging.info(f"Invalid comparison, must be 3 parts: {full_spec}")
|
||||||
|
return None
|
||||||
|
elif req_var == "distro_id":
|
||||||
|
left_op: str | Tuple[int | str, ...] = self.distro_id
|
||||||
|
right_op = dep_parts[2].strip().strip("\"'")
|
||||||
|
elif req_var == "distro_version":
|
||||||
|
if not self.distro_version:
|
||||||
|
logging.info(
|
||||||
|
"Distro Version not detected, cannot satisfy requirement: "
|
||||||
|
f"{full_spec}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
left_op = self.distro_version
|
||||||
|
right_op = _convert_version(dep_parts[2].strip().strip("\"'"))
|
||||||
|
else:
|
||||||
|
logging.info(f"Invalid requirement specifier: {full_spec}")
|
||||||
|
return None
|
||||||
|
operator = dep_parts[1].strip()
|
||||||
|
try:
|
||||||
|
compfunc = {
|
||||||
|
"<": lambda x, y: x < y,
|
||||||
|
">": lambda x, y: x > y,
|
||||||
|
"==": lambda x, y: x == y,
|
||||||
|
"!=": lambda x, y: x != y,
|
||||||
|
">=": lambda x, y: x >= y,
|
||||||
|
"<=": lambda x, y: x <= y
|
||||||
|
}.get(operator, lambda x, y: False)
|
||||||
|
result = compfunc(left_op, right_op)
|
||||||
|
if last_logical_op == "and":
|
||||||
|
last_result &= result
|
||||||
|
else:
|
||||||
|
last_result |= result
|
||||||
|
last_logical_op = None
|
||||||
|
except Exception:
|
||||||
|
logging.exception(f"Error comparing requirements: {full_spec}")
|
||||||
|
return None
|
||||||
|
if last_result:
|
||||||
|
return pkg_name
|
||||||
|
return None
|
||||||
|
|
||||||
|
def parse_dependencies(self, sys_deps: Dict[str, List[str]]) -> List[str]:
|
||||||
|
if not self.distro_id:
|
||||||
|
logging.info(
|
||||||
|
"Failed to detect current distro ID, cannot parse dependencies"
|
||||||
|
)
|
||||||
|
return []
|
||||||
|
all_ids = [self.distro_id] + self.aliases
|
||||||
|
for distro_id in all_ids:
|
||||||
|
if distro_id in sys_deps:
|
||||||
|
if not sys_deps[distro_id]:
|
||||||
|
logging.info(
|
||||||
|
f"Dependency data contains an empty package definition "
|
||||||
|
f"for linux distro '{distro_id}'"
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
processed_deps: List[str] = []
|
||||||
|
for dep in sys_deps[distro_id]:
|
||||||
|
parsed_dep = self._parse_spec(dep)
|
||||||
|
if parsed_dep is not None:
|
||||||
|
processed_deps.append(parsed_dep)
|
||||||
|
return processed_deps
|
||||||
|
else:
|
||||||
|
logging.info(
|
||||||
|
f"Dependency data has no package definition for linux "
|
||||||
|
f"distro '{self.distro_id}'"
|
||||||
|
)
|
||||||
|
return []
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 shutil
|
import shutil
|
||||||
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
from components.moonraker import (
|
from components.moonraker import (
|
||||||
@@ -138,3 +139,12 @@ def backup_moonraker_db_dir() -> None:
|
|||||||
bm.backup_directory(
|
bm.backup_directory(
|
||||||
name, source=instance.db_dir, target=MOONRAKER_DB_BACKUP_DIR
|
name, source=instance.db_dir, target=MOONRAKER_DB_BACKUP_DIR
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def load_sysdeps_json(file: Path) -> Dict[str, List[str]]:
|
||||||
|
try:
|
||||||
|
sysdeps: Dict[str, List[str]] = json.loads(file.read_bytes())
|
||||||
|
except json.JSONDecodeError as e:
|
||||||
|
Logger.print_error(f"Unable to parse {file.name}:\n{e}")
|
||||||
|
return {}
|
||||||
|
else:
|
||||||
|
return sysdeps
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -144,7 +144,7 @@ def install_client(
|
|||||||
custom_color=Color.GREEN,
|
custom_color=Color.GREEN,
|
||||||
center_content=True,
|
center_content=True,
|
||||||
content=[
|
content=[
|
||||||
f"Open {client.display_name} now on: http://{get_ipv4_addr()}:{port}",
|
f"Open {client.display_name} now on: http://{get_ipv4_addr()}{'' if port == 80 else f':{port}'}",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -79,14 +79,14 @@ class BackupManager:
|
|||||||
|
|
||||||
if source is None or not Path(source).exists():
|
if source is None or not Path(source).exists():
|
||||||
Logger.print_info("Source directory does not exist! Skipping ...")
|
Logger.print_info("Source directory does not exist! Skipping ...")
|
||||||
return
|
return None
|
||||||
|
|
||||||
target = self.backup_root_dir if target is None else target
|
target = self.backup_root_dir if target is None else target
|
||||||
try:
|
try:
|
||||||
date = get_current_date().get("date")
|
date = get_current_date().get("date")
|
||||||
time = get_current_date().get("time")
|
time = get_current_date().get("time")
|
||||||
backup_target = target.joinpath(f"{name.lower()}-{date}-{time}")
|
backup_target = target.joinpath(f"{name.lower()}-{date}-{time}")
|
||||||
shutil.copytree(source, backup_target, ignore=self.ignore_folders_func)
|
shutil.copytree(source, backup_target, ignore=self.ignore_folders_func, ignore_dangling_symlinks=True)
|
||||||
Logger.print_ok("Backup successful!")
|
Logger.print_ok("Backup successful!")
|
||||||
|
|
||||||
return backup_target
|
return backup_target
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -27,6 +27,12 @@ class DialogType(Enum):
|
|||||||
LINE_WIDTH = 53
|
LINE_WIDTH = 53
|
||||||
|
|
||||||
|
|
||||||
|
BORDER_TOP: str = "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
|
||||||
|
BORDER_BOTTOM: str = "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
|
||||||
|
BORDER_TITLE: str = "┠───────────────────────────────────────────────────────┨"
|
||||||
|
BORDER_LEFT: str = "┃"
|
||||||
|
BORDER_RIGHT: str = "┃"
|
||||||
|
|
||||||
class Logger:
|
class Logger:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def print_info(msg, prefix=True, start="", end="\n") -> None:
|
def print_info(msg, prefix=True, start="", end="\n") -> None:
|
||||||
@@ -81,23 +87,27 @@ class Logger:
|
|||||||
:param margin_top: The number of empty lines to print before the dialog.
|
:param margin_top: The number of empty lines to print before the dialog.
|
||||||
:param margin_bottom: The number of empty lines to print after the dialog.
|
:param margin_bottom: The number of empty lines to print after the dialog.
|
||||||
"""
|
"""
|
||||||
dialog_color = Logger._get_dialog_color(title, custom_color)
|
color = Logger._get_dialog_color(title, custom_color)
|
||||||
dialog_title = Logger._get_dialog_title(title, custom_title)
|
dialog_title = Logger._get_dialog_title(title, custom_title)
|
||||||
dialog_title_formatted = Logger._format_dialog_title(dialog_title, dialog_color)
|
|
||||||
dialog_content = Logger.format_content(
|
|
||||||
content,
|
|
||||||
LINE_WIDTH,
|
|
||||||
dialog_color,
|
|
||||||
center_content,
|
|
||||||
)
|
|
||||||
top = Logger._format_top_border(dialog_color)
|
|
||||||
bottom = Logger._format_bottom_border(dialog_color)
|
|
||||||
|
|
||||||
print("\n" * margin_top)
|
print("\n" * margin_top)
|
||||||
print(
|
|
||||||
f"{top}{dialog_title_formatted}{dialog_content}{bottom}",
|
print(Color.apply(BORDER_TOP, color))
|
||||||
end="",
|
|
||||||
)
|
if dialog_title:
|
||||||
|
print(Color.apply(f"┃ {dialog_title:^{LINE_WIDTH}} ┃", color))
|
||||||
|
print(Color.apply(BORDER_TITLE, color))
|
||||||
|
|
||||||
|
if content:
|
||||||
|
print(Logger.format_content(
|
||||||
|
content,
|
||||||
|
LINE_WIDTH,
|
||||||
|
color,
|
||||||
|
center_content,
|
||||||
|
))
|
||||||
|
|
||||||
|
print(Color.apply(BORDER_BOTTOM, color))
|
||||||
|
|
||||||
print("\n" * margin_bottom)
|
print("\n" * margin_bottom)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -119,31 +129,6 @@ class Logger:
|
|||||||
|
|
||||||
return color
|
return color
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _format_top_border(color: Color) -> str:
|
|
||||||
_border = Color.apply(
|
|
||||||
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n", color
|
|
||||||
)
|
|
||||||
return _border
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _format_bottom_border(color: Color) -> str:
|
|
||||||
_border = Color.apply(
|
|
||||||
"\n┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛", color
|
|
||||||
)
|
|
||||||
return _border
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _format_dialog_title(title: str | None, color: Color) -> str:
|
|
||||||
if title is None:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
_title = Color.apply(f"┃ {title:^{LINE_WIDTH}} ┃\n", color)
|
|
||||||
_title += Color.apply(
|
|
||||||
"┠───────────────────────────────────────────────────────┨\n", color
|
|
||||||
)
|
|
||||||
return _title
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def format_content(
|
def format_content(
|
||||||
content: List[str],
|
content: List[str],
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -15,6 +15,7 @@ from components.klipper import KLIPPER_DIR
|
|||||||
from components.klipper.klipper import Klipper
|
from components.klipper.klipper import Klipper
|
||||||
from components.klipper_firmware.menus.klipper_build_menu import (
|
from components.klipper_firmware.menus.klipper_build_menu import (
|
||||||
KlipperBuildFirmwareMenu,
|
KlipperBuildFirmwareMenu,
|
||||||
|
KlipperKConfigMenu,
|
||||||
)
|
)
|
||||||
from components.klipper_firmware.menus.klipper_flash_menu import (
|
from components.klipper_firmware.menus.klipper_flash_menu import (
|
||||||
KlipperFlashMethodMenu,
|
KlipperFlashMethodMenu,
|
||||||
@@ -76,12 +77,15 @@ class AdvancedMenu(BaseMenu):
|
|||||||
rollback_repository(MOONRAKER_DIR, Moonraker)
|
rollback_repository(MOONRAKER_DIR, Moonraker)
|
||||||
|
|
||||||
def build(self, **kwargs) -> None:
|
def build(self, **kwargs) -> None:
|
||||||
|
KlipperKConfigMenu().run()
|
||||||
KlipperBuildFirmwareMenu(previous_menu=self.__class__).run()
|
KlipperBuildFirmwareMenu(previous_menu=self.__class__).run()
|
||||||
|
|
||||||
def flash(self, **kwargs) -> None:
|
def flash(self, **kwargs) -> None:
|
||||||
|
KlipperKConfigMenu().run()
|
||||||
KlipperFlashMethodMenu(previous_menu=self.__class__).run()
|
KlipperFlashMethodMenu(previous_menu=self.__class__).run()
|
||||||
|
|
||||||
def build_flash(self, **kwargs) -> None:
|
def build_flash(self, **kwargs) -> None:
|
||||||
|
KlipperKConfigMenu().run()
|
||||||
KlipperBuildFirmwareMenu(previous_menu=KlipperFlashMethodMenu).run()
|
KlipperBuildFirmwareMenu(previous_menu=KlipperFlashMethodMenu).run()
|
||||||
KlipperFlashMethodMenu(previous_menu=self.__class__).run()
|
KlipperFlashMethodMenu(previous_menu=self.__class__).run()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -13,7 +13,7 @@ from typing import Type
|
|||||||
|
|
||||||
from components.klipper.klipper_utils import backup_klipper_dir
|
from components.klipper.klipper_utils import backup_klipper_dir
|
||||||
from components.klipperscreen.klipperscreen import backup_klipperscreen_dir
|
from components.klipperscreen.klipperscreen import backup_klipperscreen_dir
|
||||||
from components.moonraker.moonraker_utils import (
|
from components.moonraker.utils.utils import (
|
||||||
backup_moonraker_db_dir,
|
backup_moonraker_db_dir,
|
||||||
backup_moonraker_dir,
|
backup_moonraker_dir,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -16,7 +16,7 @@ from components.crowsnest.crowsnest import get_crowsnest_status
|
|||||||
from components.klipper.klipper_utils import get_klipper_status
|
from components.klipper.klipper_utils import get_klipper_status
|
||||||
from components.klipperscreen.klipperscreen import get_klipperscreen_status
|
from components.klipperscreen.klipperscreen import get_klipperscreen_status
|
||||||
from components.log_uploads.menus.log_upload_menu import LogUploadMenu
|
from components.log_uploads.menus.log_upload_menu import LogUploadMenu
|
||||||
from components.moonraker.moonraker_utils import get_moonraker_status
|
from components.moonraker.utils.utils import get_moonraker_status
|
||||||
from components.webui_client.client_utils import (
|
from components.webui_client.client_utils import (
|
||||||
get_client_status,
|
get_client_status,
|
||||||
get_current_client_config,
|
get_current_client_config,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -15,15 +15,13 @@ from typing import Literal, Tuple, Type
|
|||||||
from components.klipper import KLIPPER_DIR, KLIPPER_REPO_URL
|
from components.klipper import KLIPPER_DIR, KLIPPER_REPO_URL
|
||||||
from components.klipper.klipper_utils import get_klipper_status
|
from components.klipper.klipper_utils import get_klipper_status
|
||||||
from components.moonraker import MOONRAKER_DIR, MOONRAKER_REPO_URL
|
from components.moonraker import MOONRAKER_DIR, MOONRAKER_REPO_URL
|
||||||
from components.moonraker.moonraker_utils import get_moonraker_status
|
from components.moonraker.utils.utils import get_moonraker_status
|
||||||
from core.logger import DialogType, Logger
|
from core.logger import DialogType, Logger
|
||||||
from core.menus import Option
|
from core.menus import Option
|
||||||
from core.menus.base_menu import BaseMenu
|
from core.menus.base_menu import BaseMenu
|
||||||
from core.settings.kiauh_settings import KiauhSettings, RepoSettings
|
from core.settings.kiauh_settings import KiauhSettings, RepoSettings
|
||||||
from core.types.color import Color
|
from core.types.color import Color
|
||||||
from core.types.component_status import ComponentStatus
|
|
||||||
from procedures.switch_repo import run_switch_repo_routine
|
from procedures.switch_repo import run_switch_repo_routine
|
||||||
from utils.git_utils import get_repo_name
|
|
||||||
from utils.input_utils import get_confirm, get_string_input
|
from utils.input_utils import get_confirm, get_string_input
|
||||||
|
|
||||||
|
|
||||||
@@ -141,12 +139,12 @@ class SettingsMenu(BaseMenu):
|
|||||||
|
|
||||||
repo = get_string_input(
|
repo = get_string_input(
|
||||||
"Enter new repository URL",
|
"Enter new repository URL",
|
||||||
regex="^[\w/.:-]+$",
|
regex=r"^[\w/.:-]+$",
|
||||||
default=KLIPPER_REPO_URL if repo_name == "klipper" else MOONRAKER_REPO_URL,
|
default=KLIPPER_REPO_URL if repo_name == "klipper" else MOONRAKER_REPO_URL,
|
||||||
)
|
)
|
||||||
branch = get_string_input(
|
branch = get_string_input(
|
||||||
"Enter new branch name",
|
"Enter new branch name",
|
||||||
regex="^.+$",
|
regex=r"^.+$",
|
||||||
default="master"
|
default="master"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -21,7 +21,7 @@ from components.klipperscreen.klipperscreen import (
|
|||||||
update_klipperscreen,
|
update_klipperscreen,
|
||||||
)
|
)
|
||||||
from components.moonraker.moonraker_setup import update_moonraker
|
from components.moonraker.moonraker_setup import update_moonraker
|
||||||
from components.moonraker.moonraker_utils import get_moonraker_status
|
from components.moonraker.utils.utils import get_moonraker_status
|
||||||
from components.webui_client.client_config.client_config_setup import (
|
from components.webui_client.client_config.client_config_setup import (
|
||||||
update_client_config,
|
update_client_config,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -188,7 +188,7 @@ class OctoappExtension(BaseExtension):
|
|||||||
Logger.print_status("Removing OctoApp for Klipper store directory ...")
|
Logger.print_status("Removing OctoApp for Klipper store directory ...")
|
||||||
|
|
||||||
klipper_instances: List[Moonraker] = get_instances(Klipper)
|
klipper_instances: List[Moonraker] = get_instances(Klipper)
|
||||||
|
|
||||||
for instance in klipper_instances:
|
for instance in klipper_instances:
|
||||||
store_dir = instance.data_dir.joinpath("octoapp-store")
|
store_dir = instance.data_dir.joinpath("octoapp-store")
|
||||||
if not store_dir.exists():
|
if not store_dir.exists():
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -118,7 +118,7 @@ class MoonrakerTelegramBot:
|
|||||||
)
|
)
|
||||||
env_file_content = env_file_content.replace(
|
env_file_content = env_file_content.replace(
|
||||||
"%CFG%",
|
"%CFG%",
|
||||||
f"{self.base.cfg_dir}/printer.cfg",
|
self.cfg_file.as_posix()
|
||||||
)
|
)
|
||||||
env_file_content = env_file_content.replace(
|
env_file_content = env_file_content.replace(
|
||||||
"%LOG%",
|
"%LOG%",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -31,7 +31,7 @@ def change_system_hostname() -> None:
|
|||||||
"http://<hostname>.local",
|
"http://<hostname>.local",
|
||||||
"\n\n",
|
"\n\n",
|
||||||
"Example: If you set your hostname to 'my-printer', you can access an "
|
"Example: If you set your hostname to 'my-printer', you can access an "
|
||||||
"installed webinterface by tyoing 'http://my-printer.local' in the "
|
"installed webinterface by typing 'http://my-printer.local' in the "
|
||||||
"browser.",
|
"browser.",
|
||||||
],
|
],
|
||||||
custom_title="CHANGE SYSTEM HOSTNAME",
|
custom_title="CHANGE SYSTEM HOSTNAME",
|
||||||
@@ -51,7 +51,7 @@ def change_system_hostname() -> None:
|
|||||||
)
|
)
|
||||||
hostname = get_string_input(
|
hostname = get_string_input(
|
||||||
"Enter the new hostname",
|
"Enter the new hostname",
|
||||||
regex="^[a-z0-9]+([a-z0-9-]*[a-z0-9])?$",
|
regex=r"^[a-z0-9]+([a-z0-9-]*[a-z0-9])?$",
|
||||||
)
|
)
|
||||||
if not get_confirm(f"Change the hostname to '{hostname}'?", default_choice=False):
|
if not get_confirm(f"Change the hostname to '{hostname}'?", default_choice=False):
|
||||||
Logger.print_info("Aborting hostname change ...")
|
Logger.print_info("Aborting hostname change ...")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
@@ -43,7 +43,8 @@ def get_kiauh_version() -> str:
|
|||||||
Helper method to get the current KIAUH version by reading the latest tag
|
Helper method to get the current KIAUH version by reading the latest tag
|
||||||
:return: string of the latest tag
|
:return: string of the latest tag
|
||||||
"""
|
"""
|
||||||
return get_local_tags(Path(__file__).parent.parent)[-1]
|
lastest_tag: str = get_local_tags(Path(__file__).parent.parent)[-1]
|
||||||
|
return lastest_tag
|
||||||
|
|
||||||
|
|
||||||
def convert_camelcase_to_kebabcase(name: str) -> str:
|
def convert_camelcase_to_kebabcase(name: str) -> str:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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,6 +1,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from http.client import HTTPResponse
|
from http.client import HTTPResponse
|
||||||
@@ -118,7 +119,7 @@ def get_local_tags(repo_path: Path, _filter: str | None = None) -> List[str]:
|
|||||||
:return: List of tags
|
:return: List of tags
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
cmd = ["git", "tag", "-l"]
|
cmd: List[str] = ["git", "tag", "-l"]
|
||||||
|
|
||||||
if _filter is not None:
|
if _filter is not None:
|
||||||
cmd.append(f"'${_filter}'")
|
cmd.append(f"'${_filter}'")
|
||||||
@@ -129,8 +130,10 @@ def get_local_tags(repo_path: Path, _filter: str | None = None) -> List[str]:
|
|||||||
cwd=repo_path.as_posix(),
|
cwd=repo_path.as_posix(),
|
||||||
).decode(encoding="utf-8")
|
).decode(encoding="utf-8")
|
||||||
|
|
||||||
tags = result.split("\n")
|
tags: List[str] = result.split("\n")[:-1]
|
||||||
return tags[:-1]
|
|
||||||
|
return sorted(tags, key=lambda x: [int(i) if i.isdigit() else i for i in
|
||||||
|
re.split(r'(\d+)', x)])
|
||||||
|
|
||||||
except CalledProcessError:
|
except CalledProcessError:
|
||||||
return []
|
return []
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# Copyright (C) 2020 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 - 2024 Dominik Willner <th33xitus@gmail.com> #
|
# Copyright (C) 2020 - 2025 Dominik Willner <th33xitus@gmail.com> #
|
||||||
# #
|
# #
|
||||||
# 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 #
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user