From fec1b7095bbd62092ce1c9758a2426b61c774c43 Mon Sep 17 00:00:00 2001 From: AlexTemirov Date: Mon, 10 Aug 2026 16:43:54 -0700 Subject: [PATCH] Recognize snapshot Runtime during Hardware install --- editor-server/device_installer.py | 7 +++++-- tests/test_editor_devices.py | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/editor-server/device_installer.py b/editor-server/device_installer.py index 68c6a4d..2cd8798 100644 --- a/editor-server/device_installer.py +++ b/editor-server/device_installer.py @@ -2095,7 +2095,10 @@ def report(percent: int, message: str) -> None: runtime_dir="$organized_runtime_dir" hardware_dir="$organized_hardware_dir" layout="organized" -if [[ ! -d "$runtime_dir/.git" || ! -f "$runtime_dir/pyproject.toml" ]]; then +valid_runtime() { + [[ -f "$1/pyproject.toml" && -f "$1/blacknode_runtime/__init__.py" ]] +} +if ! valid_runtime "$runtime_dir"; then runtime_dir="$legacy_runtime_dir" hardware_dir="$legacy_hardware_dir" layout="legacy" @@ -2106,7 +2109,7 @@ def report(percent: int, message: str) -> None: "$HOME/blacknode-hardware-instances/"*) ;; *) echo "Unsafe Hardware directory."; exit 2 ;; esac -[[ -d "$runtime_dir/.git" && -f "$runtime_dir/pyproject.toml" ]] || { +valid_runtime "$runtime_dir" || { echo "No valid Runtime installation was found. Checked:" echo " $organized_runtime_dir" echo " $legacy_runtime_dir" diff --git a/tests/test_editor_devices.py b/tests/test_editor_devices.py index fcc7cac..931d4eb 100644 --- a/tests/test_editor_devices.py +++ b/tests/test_editor_devices.py @@ -1167,6 +1167,14 @@ def fake_run(_connection, command, **kwargs): self.assertIn('legacy_runtime_dir="$HOME/blacknode-runtime"', uploaded[0]) self.assertIn('legacy_hardware_dir="$HOME/blacknode-hardware"', uploaded[0]) self.assertIn('layout="legacy"', uploaded[0]) + self.assertIn( + '[[ -f "$1/pyproject.toml" && -f "$1/blacknode_runtime/__init__.py" ]]', + uploaded[0], + ) + self.assertNotIn( + '[[ -d "$runtime_dir/.git" && -f "$runtime_dir/pyproject.toml" ]]', + uploaded[0], + ) self.assertIn( "git clone https://github.com/temiroff/blacknode-robot.git", uploaded[0],