mirror of
https://github.com/dw-0/kiauh.git
synced 2026-05-05 08:48:16 +05:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b90a8f13b1 |
@@ -31,6 +31,7 @@ from components.moonraker.services.moonraker_setup_service import (
|
||||
from core.instance_manager.instance_manager import InstanceManager
|
||||
from core.logger import Logger
|
||||
from core.services.backup_service import BackupService
|
||||
from core.settings.kiauh_settings import KiauhSettings
|
||||
from utils.git_utils import GitException, git_clone_wrapper
|
||||
from utils.instance_utils import get_instances
|
||||
from utils.sys_utils import (
|
||||
@@ -47,6 +48,11 @@ class RepoSwitchFailedException(Exception):
|
||||
def run_switch_repo_routine(
|
||||
name: Literal["klipper", "moonraker"], repo_url: str, branch: str
|
||||
) -> None:
|
||||
if name not in ("klipper", "moonraker"):
|
||||
raise ValueError(
|
||||
f"Invalid name: {name!r}. Must be 'klipper' or 'moonraker'."
|
||||
)
|
||||
|
||||
repo_dir: Path = KLIPPER_DIR if name == "klipper" else MOONRAKER_DIR
|
||||
env_dir: Path = KLIPPER_ENV_DIR if name == "klipper" else MOONRAKER_ENV_DIR
|
||||
req_file = KLIPPER_REQ_FILE if name == "klipper" else MOONRAKER_REQ_FILE
|
||||
@@ -89,7 +95,16 @@ def run_switch_repo_routine(
|
||||
|
||||
# step 6: recreate python virtualenv
|
||||
Logger.print_status(f"Recreating {_type.__name__} virtualenv ...")
|
||||
if not create_python_venv(env_dir, force=True):
|
||||
|
||||
settings = KiauhSettings()
|
||||
if name == "klipper":
|
||||
use_python_binary = settings.klipper.use_python_binary
|
||||
elif name == "moonraker":
|
||||
use_python_binary = settings.moonraker.use_python_binary
|
||||
|
||||
if not create_python_venv(
|
||||
env_dir, force=True, use_python_binary=use_python_binary
|
||||
):
|
||||
raise GitException(f"Failed to recreate virtualenv for {_type.__name__}")
|
||||
else:
|
||||
install_python_requirements(env_dir, req_file)
|
||||
|
||||
Reference in New Issue
Block a user