Compare commits

...

5 Commits

Author SHA1 Message Date
dw-0
aa5cf8e774 Merge 1bd17359c6 into dbe15e3a32 2024-06-28 21:39:20 +02:00
dw-0
1bd17359c6 fix: add instance names to blacklist
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-06-28 21:32:45 +02:00
dw-0
60e7df37fc chore: remove unused argument
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-06-28 20:15:49 +02:00
dw-0
ca493e91ef chore: cleanup
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-06-28 20:13:44 +02:00
dw-0
3ec5e1a3b8 refactor: implement octoeverywhere update
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
2024-06-28 20:13:33 +02:00
6 changed files with 35 additions and 22 deletions

View File

@@ -271,7 +271,6 @@ def handle_disruptive_system_packages() -> None:
"Please fix the problem manually. Otherwise, this may have "
"undesirable effects on the operation of Klipper."
],
padding_bottom="",
)

View File

@@ -20,8 +20,6 @@ OE_STORE_DIR = OE_DIR.joinpath("octoeverywhere-store")
OE_REQ_FILE = OE_DIR.joinpath("requirements.txt")
OE_DEPS_JSON_FILE = OE_DIR.joinpath("moonraker-system-dependencies.json")
OE_INSTALL_SCRIPT = OE_DIR.joinpath("install.sh")
OE_UPDATE_SCRIPT = OE_DIR.joinpath("update.sh")
OE_REMOVE_SCRIPT = OE_DIR.joinpath("uninstall.sh")
# filenames
OE_CFG_NAME = "octoeverywhere.conf"

View File

@@ -23,14 +23,11 @@ from components.octoeverywhere import (
from core.instance_manager.base_instance import BaseInstance
from utils.logger import Logger
MODULE_PATH = Path(__file__).resolve().parent
# noinspection PyMethodMayBeStatic
class Octoeverywhere(BaseInstance):
@classmethod
def blacklist(cls) -> List[str]:
return ["None", "mcu"]
return ["None", "mcu", "bambu", "companion"]
def __init__(self, suffix: str = ""):
super().__init__(instance_type=self, suffix=suffix)
@@ -45,6 +42,10 @@ class Octoeverywhere(BaseInstance):
def cfg_file(self) -> Path:
return self._cfg_file
@property
def sys_cfg_file(self) -> Path:
return self._sys_cfg_file
@property
def log(self) -> Path:
return self._log
@@ -54,7 +55,6 @@ class Octoeverywhere(BaseInstance):
try:
cmd = f"{OE_INSTALL_SCRIPT} {self.cfg_dir}/moonraker.conf"
print(cmd)
run(cmd, check=True, shell=True)
except CalledProcessError as e:

View File

@@ -23,9 +23,12 @@ from components.octoeverywhere import (
)
from components.octoeverywhere.octoeverywhere import Octoeverywhere
from core.instance_manager.instance_manager import InstanceManager
from utils.common import check_install_dependencies, moonraker_exists
from utils.common import (
check_install_dependencies,
get_install_status,
moonraker_exists,
)
from utils.config_utils import (
add_config_section,
remove_config_section,
)
from utils.fs_utils import run_remove_routines
@@ -34,10 +37,14 @@ from utils.input_utils import get_confirm
from utils.logger import DialogType, Logger
from utils.sys_utils import (
cmd_sysctl_manage,
create_python_venv,
install_python_requirements,
parse_packages_from_file,
)
from utils.types import ComponentStatus
def get_octoeverywhere_status() -> ComponentStatus:
return get_install_status(OE_DIR, OE_ENV_DIR, Octoeverywhere)
def install_octoeverywhere() -> None:
@@ -57,6 +64,8 @@ def install_octoeverywhere() -> None:
"It is save to run the installer again to link your "
"printer or repair any issues.",
],
padding_top=0,
padding_bottom=0,
)
if not get_confirm("Re-run OctoEverywhere installation?"):
Logger.print_info("Exiting OctoEverywhere for Klipper installation ...")
@@ -77,6 +86,8 @@ def install_octoeverywhere() -> None:
"\n\n",
"The setup will apply the same names to OctoEverywhere!",
],
padding_top=0,
padding_bottom=0,
)
if not get_confirm(
@@ -89,7 +100,6 @@ def install_octoeverywhere() -> None:
try:
git_clone_wrapper(OE_REPO, OE_DIR)
install_oe_dependencies()
for moonraker in mr_instances:
oe_im.current_instance = Octoeverywhere(suffix=moonraker.suffix)
@@ -160,16 +170,9 @@ def install_oe_dependencies() -> None:
raise ValueError("Error reading OctoEverywhere dependencies!")
check_install_dependencies(oe_deps)
# create virtualenv
create_python_venv(OE_ENV_DIR)
install_python_requirements(OE_ENV_DIR, OE_REQ_FILE)
def patch_moonraker_conf(instances: List[Moonraker]) -> None:
add_config_section(section=f"include {OE_SYS_CFG_NAME}", instances=instances)
def remove_oe_instances(
instance_manager: InstanceManager,
instance_list: List[Octoeverywhere],

View File

@@ -16,6 +16,7 @@ from components.klipperscreen.klipperscreen import get_klipperscreen_status
from components.log_uploads.menus.log_upload_menu import LogUploadMenu
from components.mobileraker.mobileraker import get_mobileraker_status
from components.moonraker.moonraker_utils import get_moonraker_status
from components.octoeverywhere.octoeverywhere_setup import get_octoeverywhere_status
from components.webui_client.client_utils import (
get_client_status,
get_current_client_config,
@@ -91,6 +92,7 @@ class MainMenu(BaseMenu):
self._get_component_status("ks", get_klipperscreen_status)
self._get_component_status("mb", get_mobileraker_status)
self._get_component_status("cn", get_crowsnest_status)
self._get_component_status("oe", get_octoeverywhere_status)
def _get_component_status(self, name: str, status_fn: callable, *args) -> None:
status_data: ComponentStatus = status_fn(*args)

View File

@@ -25,6 +25,10 @@ from components.mobileraker.mobileraker import (
)
from components.moonraker.moonraker_setup import update_moonraker
from components.moonraker.moonraker_utils import get_moonraker_status
from components.octoeverywhere.octoeverywhere_setup import (
get_octoeverywhere_status,
update_octoeverywhere,
)
from components.webui_client.client_config.client_config_setup import (
update_client_config,
)
@@ -57,7 +61,7 @@ class UpdateMenu(BaseMenu):
self.ms_local = self.ms_remote = self.fl_local = self.fl_remote = ""
self.mc_local = self.mc_remote = self.fc_local = self.fc_remote = ""
self.ks_local = self.ks_remote = self.mb_local = self.mb_remote = ""
self.cn_local = self.cn_remote = ""
self.cn_local = self.cn_remote = self.oe_local = self.oe_remote = ""
self.mainsail_data = MainsailData()
self.fluidd_data = FluiddData()
@@ -82,7 +86,8 @@ class UpdateMenu(BaseMenu):
"7": Option(self.update_klipperscreen, menu=False),
"8": Option(self.update_mobileraker, menu=False),
"9": Option(self.update_crowsnest, menu=False),
"10": Option(self.upgrade_system_packages, menu=False),
"10": Option(self.update_octoeverywhere, menu=False),
"11": Option(self.upgrade_system_packages, menu=False),
}
def print_menu(self):
@@ -114,8 +119,9 @@ class UpdateMenu(BaseMenu):
║ 7) KlipperScreen │ {self.ks_local:<22}{self.ks_remote:<22}
║ 8) Mobileraker │ {self.mb_local:<22}{self.mb_remote:<22}
║ 9) Crowsnest │ {self.cn_local:<22}{self.cn_remote:<22}
║ 10) OctoEverywhere │ {self.oe_local:<22}{self.oe_remote:<22}
║ ├───────────────┴───────────────╢
║ 10) System │ ║
║ 11) System │ ║
╟───────────────────────┴───────────────────────────────╢
"""
)[1:]
@@ -151,6 +157,9 @@ class UpdateMenu(BaseMenu):
def update_crowsnest(self, **kwargs):
update_crowsnest()
def update_octoeverywhere(self, **kwargs):
update_octoeverywhere()
def upgrade_system_packages(self, **kwargs): ...
def _fetch_update_status(self):
@@ -172,6 +181,8 @@ class UpdateMenu(BaseMenu):
self._get_update_status("mb", get_mobileraker_status)
# crowsnest
self._get_update_status("cn", get_crowsnest_status)
# octoeverywhere
self._get_update_status("oe", get_octoeverywhere_status)
def _format_local_status(self, local_version, remote_version) -> str:
if local_version == remote_version: