You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hamilton.apache.org by sk...@apache.org on 2026/06/07 04:39:35 UTC

(hamilton) 02/04: Fix verify scripts: prereq check and contrib CWD issue

This is an automated email from the ASF dual-hosted git repository.

skrawcz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hamilton.git

commit 1451e8aec4f0ac09a7a019606b3e561dc7af9f14
Author: Stefan Krawczyk <st...@cs.stanford.edu>
AuthorDate: Sun May 31 23:54:54 2026 -0700

    Fix verify scripts: prereq check and contrib CWD issue
    
    - Add prerequisite check for gpg, java, flit, uv, svn at script start
      (fails early with clear error instead of cryptic flit-not-found)
    - Fix contrib verify: cd to /tmp before running python imports to avoid
      CWD shadowing installed hamilton package with local repo directory
---
 scripts/verify-sub-packages/verify_contrib.sh | 11 +++++++++++
 scripts/verify-sub-packages/verify_lsp.sh     |  8 ++++++++
 scripts/verify-sub-packages/verify_sdk.sh     |  8 ++++++++
 scripts/verify-sub-packages/verify_ui.sh      |  8 ++++++++
 4 files changed, 35 insertions(+)

diff --git a/scripts/verify-sub-packages/verify_contrib.sh b/scripts/verify-sub-packages/verify_contrib.sh
index 3a4b6e8c..dfde3214 100755
--- a/scripts/verify-sub-packages/verify_contrib.sh
+++ b/scripts/verify-sub-packages/verify_contrib.sh
@@ -38,6 +38,14 @@ if [ -z "$VERSION" ] || [ -z "$RC" ]; then
 fi
 
 SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+
+# Check prerequisites
+for cmd in gpg java flit uv svn; do
+    if ! command -v "$cmd" > /dev/null 2>&1; then
+        echo "ERROR: $cmd is required but not found. Please install it."
+        exit 1
+    fi
+done
 PACKAGE="apache-hamilton-contrib"
 SRC_TAR="${PACKAGE}-${VERSION}-incubating-src.tar.gz"
 WHEEL="apache_hamilton_contrib-${VERSION}-py3-none-any.whl"
@@ -135,6 +143,9 @@ cd /tmp  # prevent '' in sys.path from resolving local hamilton checkout
 
 uv pip install -q "$ARTIFACTS_DIR/$WHEEL" apache-hamilton
 
+# Run from /tmp to avoid CWD shadowing the installed hamilton package
+cd /tmp
+
 python -c "import importlib.metadata; assert importlib.metadata.version('apache-hamilton-contrib') == '${VERSION}'"
 echo "  ✓ Version correct"
 
diff --git a/scripts/verify-sub-packages/verify_lsp.sh b/scripts/verify-sub-packages/verify_lsp.sh
index d76ddcc4..976e4e31 100755
--- a/scripts/verify-sub-packages/verify_lsp.sh
+++ b/scripts/verify-sub-packages/verify_lsp.sh
@@ -38,6 +38,14 @@ if [ -z "$VERSION" ] || [ -z "$RC" ]; then
 fi
 
 SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+
+# Check prerequisites
+for cmd in gpg java flit uv svn; do
+    if ! command -v "$cmd" > /dev/null 2>&1; then
+        echo "ERROR: $cmd is required but not found. Please install it."
+        exit 1
+    fi
+done
 PACKAGE="apache-hamilton-lsp"
 SRC_TAR="${PACKAGE}-${VERSION}-incubating-src.tar.gz"
 WHEEL="apache_hamilton_lsp-${VERSION}-py3-none-any.whl"
diff --git a/scripts/verify-sub-packages/verify_sdk.sh b/scripts/verify-sub-packages/verify_sdk.sh
index 25a7b75f..ea9cf4aa 100755
--- a/scripts/verify-sub-packages/verify_sdk.sh
+++ b/scripts/verify-sub-packages/verify_sdk.sh
@@ -38,6 +38,14 @@ if [ -z "$VERSION" ] || [ -z "$RC" ]; then
 fi
 
 SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+
+# Check prerequisites
+for cmd in gpg java flit uv svn; do
+    if ! command -v "$cmd" > /dev/null 2>&1; then
+        echo "ERROR: $cmd is required but not found. Please install it."
+        exit 1
+    fi
+done
 PACKAGE="apache-hamilton-sdk"
 SRC_TAR="${PACKAGE}-${VERSION}-incubating-src.tar.gz"
 WHEEL="apache_hamilton_sdk-${VERSION}-py3-none-any.whl"
diff --git a/scripts/verify-sub-packages/verify_ui.sh b/scripts/verify-sub-packages/verify_ui.sh
index 43db1900..0a7c9f5b 100755
--- a/scripts/verify-sub-packages/verify_ui.sh
+++ b/scripts/verify-sub-packages/verify_ui.sh
@@ -38,6 +38,14 @@ if [ -z "$VERSION" ] || [ -z "$RC" ]; then
 fi
 
 SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+
+# Check prerequisites
+for cmd in gpg java flit uv svn; do
+    if ! command -v "$cmd" > /dev/null 2>&1; then
+        echo "ERROR: $cmd is required but not found. Please install it."
+        exit 1
+    fi
+done
 PACKAGE="apache-hamilton-ui"
 SRC_TAR="${PACKAGE}-${VERSION}-incubating-src.tar.gz"
 WHEEL="apache_hamilton_ui-${VERSION}-py3-none-any.whl"