Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver): restore v0.12.5 and v0.12.6 installs (#2598)

injaneityfc17069b6978
diff --git a/.github/scripts/tests/test_cua_driver_release_wiring.py b/.github/scripts/tests/test_cua_driver_release_wiring.py
index 7914b92819..2828238239 100644
--- a/.github/scripts/tests/test_cua_driver_release_wiring.py
+++ b/.github/scripts/tests/test_cua_driver_release_wiring.py
@@ -259,6 +259,15 @@ class TestCuaDriverReleaseWiring(unittest.TestCase):
cleanup,
)
+ def test_release_installers_bound_cursor_theme_compatibility(self) -> None:
+ shell = self.read("libs/cua-driver/scripts/_install-rust.sh")
+ self.assertIn('CURSOR_THEME_REQUIRED_FROM="0.12.7"', shell)
+ self.assertIn('"$VERSION" "$CURSOR_THEME_REQUIRED_FROM"', shell)
+
+ powershell = self.read("libs/cua-driver/scripts/install.ps1")
+ self.assertIn('$CursorThemeRequiredFrom = [version]"0.12.7"', powershell)
+ self.assertIn("[version]$version -ge $CursorThemeRequiredFrom", powershell)
+
def test_local_installer_does_not_clean_release_or_legacy_homes(self) -> None:
installer = self.read("libs/cua-driver/scripts/_install-local-rust.sh")
diff --git a/libs/cua-driver/scripts/_install-rust.sh b/libs/cua-driver/scripts/_install-rust.sh
index 8e0a91e5c5..0d38cf1fbe 100644
--- a/libs/cua-driver/scripts/_install-rust.sh
+++ b/libs/cua-driver/scripts/_install-rust.sh
@@ -541,6 +541,19 @@ fi
VERSION="${TAG#${TAG_PREFIX}}"
+# Releases through 0.12.6 predate semantic cursor themes.
+# Newer releases must contain both packaged copies.
+CURSOR_THEME_REQUIRED_FROM="0.12.7"
+version_is_at_least() {
+ local version="$1" minimum="$2"
+ local v_major v_minor v_patch m_major m_minor m_patch
+ IFS=. read -r v_major v_minor v_patch <<< "$version"
+ IFS=. read -r m_major m_minor m_patch <<< "$minimum"
+ if (( v_major != m_major )); then (( v_major > m_major )); return; fi
+ if (( v_minor != m_minor )); then (( v_minor > m_minor )); return; fi
+ (( v_patch >= m_patch ))
+}
+
# --- Download bare-binary tarball ---------------------------------------
# Tarball selection:
@@ -599,11 +612,23 @@ if [[ ! -f "$SRC" ]]; then
ls -la "$TMP_DIR"
exit 1
fi
-if [[ ! -f "$SRC_THEME" ]]; then
+THEME_AVAILABLE=1
+if [[ ! -f "$SRC_THEME" ]] || {
+ [[ -n "$SRC_APP" ]] &&
+ [[ ! -f "$SRC_APP/Contents/MacOS/cua-cursor-theme" ]]
+}; then
+ THEME_AVAILABLE=0
+fi
+if [[ "$THEME_AVAILABLE" == "0" ]] && version_is_at_least \
+ "$VERSION" "$CURSOR_THEME_REQUIRED_FROM"; then
err "expected cua-cursor-theme in tarball but didn't find it"
ls -la "$TMP_DIR"
exit 1
fi
+if [[ "$THEME_AVAILABLE" == "0" ]]; then
+ printf 'warning: release %s predates cua-cursor-theme; installing without custom cursor themes\n' \
+ "$VERSION" >&2
+fi
# --- Install ------------------------------------------------------------
@@ -759,7 +784,9 @@ else
mkdir -p "$VERSIONED_DIR"
install -m 0755 "$SRC" "$VERSIONED_DIR/$BINARY_NAME"
- install -m 0755 "$SRC_THEME" "$VERSIONED_DIR/cua-cursor-theme"
+ if [[ "$THEME_AVAILABLE" == "1" ]]; then
+ install -m 0755 "$SRC_THEME" "$VERSIONED_DIR/cua-cursor-theme"
+ fi
log "installed $VERSIONED_DIR/$BINARY_NAME (version $VERSION, target $TARGET)"
# `ln -sfn` would replace an existing dir-symlink in place but is
diff --git a/libs/cua-driver/scripts/install.ps1 b/libs/cua-driver/scripts/install.ps1
index 820ebf6d13..619c0e3270 100644
--- a/libs/cua-driver/scripts/install.ps1
+++ b/libs/cua-driver/scripts/install.ps1
@@ -116,6 +116,7 @@ $ThemeBinaryName = "cua-cursor-theme.exe"
# ~~~ BAKED_VERSION: auto-updated in the release PR — do not edit ~~~
$Script:CuaDriverRsBakedVersion = "0.12.6" # x-release-please-version
# ~~~ END_BAKED_VERSION ~~~
+$CursorThemeRequiredFrom = [version]"0.12.7"
# ---------- Path resolution ------------------------------------------------
@@ -1100,9 +1101,13 @@ if (-not $skipDownload) {
Copy-Item -LiteralPath (Join-Path $stageDir $BinaryName) -Destination (Join-Path $versionedDir $BinaryName) -Force
$themeStage = Join-Path $stageDir $ThemeBinaryName
if (-not (Test-Path -LiteralPath $themeStage)) {
- throw "release archive is missing required $ThemeBinaryName"
+ if ([version]$version -ge $CursorThemeRequiredFrom) {
+ throw "release archive is missing required $ThemeBinaryName"
+ }
+ Write-WarningStep "release $version predates $ThemeBinaryName; installing without custom cursor themes"
+ } else {
+ Copy-Item -LiteralPath $themeStage -Destination (Join-Path $versionedDir $ThemeBinaryName) -Force
}
- Copy-Item -LiteralPath $themeStage -Destination (Join-Path $versionedDir $ThemeBinaryName) -Force
Write-Step "installed $versionedDir\$BinaryName (version $version, target $target)"
# Optional sibling: the reserved uiAccess worker
# (cua-driver-uia.exe). It started shipping with