refactor: use check_install_dependencies at more places where appropriate
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -17,7 +17,7 @@ from typing import List, Dict, Literal, Union
|
||||
from components.crowsnest import CROWSNEST_REPO, CROWSNEST_DIR
|
||||
from components.klipper.klipper import Klipper
|
||||
from core.instance_manager.instance_manager import InstanceManager
|
||||
from utils.common import get_install_status
|
||||
from utils.common import get_install_status, check_install_dependencies
|
||||
from utils.constants import COLOR_CYAN, RESET_FORMAT, CURRENT_USER
|
||||
from utils.git_utils import (
|
||||
git_clone_wrapper,
|
||||
@@ -29,10 +29,7 @@ from utils.git_utils import (
|
||||
from utils.input_utils import get_confirm
|
||||
from utils.logger import Logger
|
||||
from utils.sys_utils import (
|
||||
check_package_install,
|
||||
install_system_packages,
|
||||
parse_packages_from_file,
|
||||
update_system_package_lists,
|
||||
control_systemd_service,
|
||||
)
|
||||
|
||||
@@ -42,9 +39,7 @@ def install_crowsnest() -> None:
|
||||
git_clone_wrapper(CROWSNEST_REPO, CROWSNEST_DIR, "master")
|
||||
|
||||
# Step 2: Install dependencies
|
||||
requirements: List[str] = check_package_install(["make"])
|
||||
if requirements:
|
||||
install_system_packages(requirements)
|
||||
check_install_dependencies(["make"])
|
||||
|
||||
# Step 3: Check for Multi Instance
|
||||
im = InstanceManager(Klipper)
|
||||
@@ -114,9 +109,7 @@ def update_crowsnest() -> None:
|
||||
|
||||
script = CROWSNEST_DIR.joinpath("tools/install.sh")
|
||||
deps = parse_packages_from_file(script)
|
||||
packages = check_package_install(deps)
|
||||
update_system_package_lists(silent=False)
|
||||
install_system_packages(packages)
|
||||
check_install_dependencies(deps)
|
||||
|
||||
control_systemd_service("crowsnest", "restart")
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ from components.klipper.klipper_utils import (
|
||||
)
|
||||
from components.moonraker.moonraker import Moonraker
|
||||
from core.instance_manager.instance_manager import InstanceManager
|
||||
from utils.common import check_install_dependencies
|
||||
from utils.git_utils import git_clone_wrapper, git_pull_wrapper
|
||||
from utils.input_utils import get_confirm
|
||||
from utils.logger import Logger
|
||||
@@ -43,8 +44,6 @@ from utils.sys_utils import (
|
||||
parse_packages_from_file,
|
||||
create_python_venv,
|
||||
install_python_requirements,
|
||||
update_system_package_lists,
|
||||
install_system_packages,
|
||||
)
|
||||
|
||||
|
||||
@@ -134,8 +133,7 @@ def install_klipper_packages(klipper_dir: Path) -> None:
|
||||
if Path("/boot/dietpi/.version").exists():
|
||||
packages.append("dbus")
|
||||
|
||||
update_system_package_lists(silent=False)
|
||||
install_system_packages(packages)
|
||||
check_install_dependencies(packages)
|
||||
|
||||
|
||||
def update_klipper() -> None:
|
||||
|
||||
@@ -22,7 +22,7 @@ from components.moonraker.moonraker import Moonraker
|
||||
from core.backup_manager.backup_manager import BackupManager
|
||||
from core.instance_manager.instance_manager import InstanceManager
|
||||
from core.settings.kiauh_settings import KiauhSettings
|
||||
from utils.common import get_install_status
|
||||
from utils.common import get_install_status, check_install_dependencies
|
||||
from utils.config_utils import add_config_section, remove_config_section
|
||||
from utils.constants import SYSTEMD
|
||||
from utils.fs_utils import remove_with_sudo
|
||||
@@ -37,8 +37,6 @@ from utils.input_utils import get_confirm
|
||||
from utils.logger import Logger
|
||||
from utils.sys_utils import (
|
||||
check_python_version,
|
||||
check_package_install,
|
||||
install_system_packages,
|
||||
control_systemd_service,
|
||||
install_python_requirements,
|
||||
)
|
||||
@@ -62,9 +60,7 @@ def install_klipperscreen() -> None:
|
||||
return
|
||||
|
||||
package_list = ["wget", "curl", "unzip", "dfu-util"]
|
||||
packages = check_package_install(package_list)
|
||||
if packages:
|
||||
install_system_packages(packages)
|
||||
check_install_dependencies(package_list)
|
||||
|
||||
git_clone_wrapper(KLIPPERSCREEN_REPO, KLIPPERSCREEN_DIR)
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ from components.moonraker.moonraker_utils import (
|
||||
backup_moonraker_dir,
|
||||
)
|
||||
from core.instance_manager.instance_manager import InstanceManager
|
||||
from utils.common import check_install_dependencies
|
||||
from utils.fs_utils import check_file_exist
|
||||
from utils.git_utils import git_clone_wrapper, git_pull_wrapper
|
||||
from utils.input_utils import (
|
||||
@@ -45,8 +46,6 @@ from utils.sys_utils import (
|
||||
parse_packages_from_file,
|
||||
create_python_venv,
|
||||
install_python_requirements,
|
||||
update_system_package_lists,
|
||||
install_system_packages,
|
||||
check_python_version,
|
||||
)
|
||||
|
||||
@@ -143,8 +142,7 @@ def setup_moonraker_prerequesites() -> None:
|
||||
def install_moonraker_packages(moonraker_dir: Path) -> None:
|
||||
script = moonraker_dir.joinpath("scripts/install-moonraker.sh")
|
||||
packages = parse_packages_from_file(script)
|
||||
update_system_package_lists(silent=False)
|
||||
install_system_packages(packages)
|
||||
check_install_dependencies(packages)
|
||||
|
||||
|
||||
def install_moonraker_polkit() -> None:
|
||||
|
||||
@@ -23,7 +23,11 @@ from utils.constants import (
|
||||
COLOR_RED,
|
||||
)
|
||||
from utils.logger import Logger
|
||||
from utils.sys_utils import check_package_install, install_system_packages
|
||||
from utils.sys_utils import (
|
||||
check_package_install,
|
||||
install_system_packages,
|
||||
update_system_package_lists,
|
||||
)
|
||||
|
||||
|
||||
def get_current_date() -> Dict[Literal["date", "time"], str]:
|
||||
@@ -51,6 +55,7 @@ def check_install_dependencies(deps: List[str]) -> None:
|
||||
Logger.print_info("The following packages need installation:")
|
||||
for _ in requirements:
|
||||
print(f"{COLOR_CYAN}● {_}{RESET_FORMAT}")
|
||||
update_system_package_lists(silent=False)
|
||||
install_system_packages(requirements)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user