mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-26 17:23:35 +05:00
Compare commits
9 Commits
v6.0.0-alp
...
7b69adfe7d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b69adfe7d | ||
|
|
7e4ba0d8cd | ||
|
|
66c0757be1 | ||
|
|
3a2574f24e | ||
|
|
acb4d0398f | ||
|
|
0a08c4fb3f | ||
|
|
2d4c952b4b | ||
|
|
d5119bc264 | ||
|
|
8cb66071ac |
@@ -11,5 +11,5 @@ end_of_line = lf
|
||||
[*.py]
|
||||
max_line_length = 88
|
||||
|
||||
[*.{sh,yml,yaml}]
|
||||
indent_size = 2
|
||||
[*.sh]
|
||||
indent_size = 2
|
||||
|
||||
8
.github/workflows/fast-forward.yml
vendored
8
.github/workflows/fast-forward.yml
vendored
@@ -1,14 +1,12 @@
|
||||
name: fast-forward
|
||||
on:
|
||||
issue_comment:
|
||||
types: [ created, edited ]
|
||||
types: [created, edited]
|
||||
jobs:
|
||||
fast-forward:
|
||||
# Only run if the comment contains the /fast-forward command.
|
||||
if: |
|
||||
contains(github.event.comment.body, '/fast-forward') &&
|
||||
github.event.issue.pull_request &&
|
||||
github.base_ref == 'develop'
|
||||
if: ${{ contains(github.event.comment.body, '/fast-forward')
|
||||
&& github.event.issue.pull_request }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
|
||||
4
.github/workflows/pull-request.yml
vendored
4
.github/workflows/pull-request.yml
vendored
@@ -1,9 +1,7 @@
|
||||
name: pull-request
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
types: [ opened, reopened, synchronize ]
|
||||
types: [opened, reopened, synchronize]
|
||||
jobs:
|
||||
check-fast-forward:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -43,11 +43,7 @@ from utils.common import check_install_dependencies, get_install_status
|
||||
from utils.fs_utils import check_file_exist
|
||||
from utils.input_utils import get_confirm, get_number_input, get_string_input
|
||||
from utils.instance_utils import get_instances
|
||||
from utils.sys_utils import (
|
||||
cmd_sysctl_service,
|
||||
install_python_packages,
|
||||
parse_packages_from_file,
|
||||
)
|
||||
from utils.sys_utils import cmd_sysctl_service, parse_packages_from_file
|
||||
|
||||
|
||||
def get_klipper_status() -> ComponentStatus:
|
||||
@@ -215,42 +211,3 @@ def install_klipper_packages() -> None:
|
||||
packages.append("dbus")
|
||||
|
||||
check_install_dependencies({*packages})
|
||||
|
||||
|
||||
def install_input_shaper_deps() -> None:
|
||||
if not KLIPPER_ENV_DIR.exists():
|
||||
Logger.print_warn("Required Klipper python environment not found!")
|
||||
return
|
||||
|
||||
Logger.print_dialog(
|
||||
DialogType.CUSTOM,
|
||||
[
|
||||
"Resonance measurements and shaper auto-calibration require additional "
|
||||
"software dependencies which are not installed by default. "
|
||||
"If you agree, the following additional system packages will be installed:",
|
||||
"● python3-numpy",
|
||||
"● python3-matplotlib",
|
||||
"● libatlas-base-dev",
|
||||
"● libopenblas-dev",
|
||||
"\n\n",
|
||||
"Also, the following Python package will be installed:",
|
||||
"● numpy",
|
||||
],
|
||||
custom_title="Install Input Shaper Dependencies",
|
||||
)
|
||||
if not get_confirm(
|
||||
"Do you want to install the required packages?", default_choice=False
|
||||
):
|
||||
return
|
||||
|
||||
apt_deps = (
|
||||
"python3-numpy",
|
||||
"python3-matplotlib",
|
||||
"libatlas-base-dev",
|
||||
"libopenblas-dev",
|
||||
)
|
||||
check_install_dependencies({*apt_deps})
|
||||
|
||||
py_deps = ("numpy",)
|
||||
|
||||
install_python_packages(KLIPPER_ENV_DIR, {*py_deps})
|
||||
|
||||
@@ -13,7 +13,6 @@ from typing import Type
|
||||
|
||||
from components.klipper import KLIPPER_DIR
|
||||
from components.klipper.klipper import Klipper
|
||||
from components.klipper.klipper_utils import install_input_shaper_deps
|
||||
from components.klipper_firmware.menus.klipper_build_menu import (
|
||||
KlipperBuildFirmwareMenu,
|
||||
KlipperKConfigMenu,
|
||||
@@ -51,10 +50,9 @@ class AdvancedMenu(BaseMenu):
|
||||
"2": Option(method=self.flash),
|
||||
"3": Option(method=self.build_flash),
|
||||
"4": Option(method=self.get_id),
|
||||
"5": Option(method=self.input_shaper),
|
||||
"6": Option(method=self.klipper_rollback),
|
||||
"7": Option(method=self.moonraker_rollback),
|
||||
"8": Option(method=self.change_hostname),
|
||||
"5": Option(method=self.klipper_rollback),
|
||||
"6": Option(method=self.moonraker_rollback),
|
||||
"7": Option(method=self.change_hostname),
|
||||
}
|
||||
|
||||
def print_menu(self) -> None:
|
||||
@@ -62,13 +60,11 @@ class AdvancedMenu(BaseMenu):
|
||||
"""
|
||||
╟───────────────────────────┬───────────────────────────╢
|
||||
║ Klipper Firmware: │ Repository Rollback: ║
|
||||
║ 1) [Build] │ 6) [Klipper] ║
|
||||
║ 2) [Flash] │ 7) [Moonraker] ║
|
||||
║ 1) [Build] │ 5) [Klipper] ║
|
||||
║ 2) [Flash] │ 6) [Moonraker] ║
|
||||
║ 3) [Build + Flash] │ ║
|
||||
║ 4) [Get MCU ID] │ System: ║
|
||||
║ │ 8) [Change hostname] ║
|
||||
║ Extra Dependencies: │ ║
|
||||
║ 5) [Input Shaper] │ ║
|
||||
║ │ 7) [Change hostname] ║
|
||||
╟───────────────────────────┴───────────────────────────╢
|
||||
"""
|
||||
)[1:]
|
||||
@@ -101,6 +97,3 @@ class AdvancedMenu(BaseMenu):
|
||||
|
||||
def change_hostname(self, **kwargs) -> None:
|
||||
change_system_hostname()
|
||||
|
||||
def input_shaper(self, **kwargs) -> None:
|
||||
install_input_shaper_deps()
|
||||
|
||||
@@ -26,10 +26,9 @@ def git_clone_wrapper(
|
||||
) -> None:
|
||||
"""
|
||||
Clones a repository from the given URL and checks out the specified branch if given.
|
||||
The clone will be performed with the '--filter=blob:none' flag to perform a blobless clone.
|
||||
|
||||
:param repo: The URL of the repository to clone.
|
||||
:param branch: The branch to check out. If None, master or main, no checkout will be performed.
|
||||
:param branch: The branch to check out. If None, the default branch will be checked out.
|
||||
:param target_dir: The directory where the repository will be cloned.
|
||||
:param force: Force the cloning of the repository even if it already exists.
|
||||
:return: None
|
||||
@@ -44,11 +43,8 @@ def git_clone_wrapper(
|
||||
return
|
||||
shutil.rmtree(target_dir)
|
||||
|
||||
git_cmd_clone(repo, target_dir, blobless=True)
|
||||
|
||||
if branch not in ("master", "main"):
|
||||
git_cmd_checkout(branch, target_dir)
|
||||
|
||||
git_cmd_clone(repo, target_dir)
|
||||
git_cmd_checkout(branch, target_dir)
|
||||
except CalledProcessError:
|
||||
log = "An unexpected error occured during cloning of the repository."
|
||||
Logger.print_error(log)
|
||||
|
||||
@@ -197,38 +197,6 @@ def install_python_requirements(target: Path, requirements: Path) -> None:
|
||||
raise VenvCreationFailedException(log)
|
||||
|
||||
|
||||
def install_python_packages(target: Path, packages: List[str]) -> None:
|
||||
"""
|
||||
Installs the python packages based on a provided packages list |
|
||||
:param target: Path of the virtualenv
|
||||
:param packages: str list of required packages
|
||||
:return: None
|
||||
"""
|
||||
try:
|
||||
# always update pip before installing requirements
|
||||
update_python_pip(target)
|
||||
|
||||
Logger.print_status("Installing Python requirements ...")
|
||||
command = [
|
||||
target.joinpath("bin/pip").as_posix(),
|
||||
"install",
|
||||
]
|
||||
for pkg in packages:
|
||||
command.append(pkg)
|
||||
result = run(command, stderr=PIPE, text=True)
|
||||
|
||||
if result.returncode != 0 or result.stderr:
|
||||
Logger.print_error(f"{result.stderr}", False)
|
||||
raise VenvCreationFailedException("Installing Python requirements failed!")
|
||||
|
||||
Logger.print_ok("Installing Python requirements successful!")
|
||||
|
||||
except Exception as e:
|
||||
log = f"Error installing Python requirements: {e}"
|
||||
Logger.print_error(log)
|
||||
raise VenvCreationFailedException(log)
|
||||
|
||||
|
||||
def update_system_package_lists(silent: bool, rls_info_change=False) -> None:
|
||||
"""
|
||||
Updates the systems package list |
|
||||
|
||||
Reference in New Issue
Block a user