refactor: test_wheel.sh to dynamically find wheel files

- Updated script to search for wheel files using a pattern.
- Added error handling for cases with no matches or multiple matches.
- Improved output to indicate the found wheel file.
This commit is contained in:
2025-12-01 11:05:32 -06:00
parent 94d91c4934
commit 5627ae1640

View File

@@ -1,13 +1,30 @@
#!/bin/bash
set -e
WHEEL_PATH="python-dist/reticulum_meshchatx-2.41.0-py3-none-any.whl"
# Find wheel file dynamically
WHEEL_PATTERN="python-dist/reticulum_meshchatx-*-py3-none-any.whl"
WHEEL_FILES=($WHEEL_PATTERN)
if [ ${#WHEEL_FILES[@]} -eq 0 ]; then
echo "Error: No wheel files found matching pattern: $WHEEL_PATTERN"
echo "Make sure to run 'poetry build' or similar to create the wheel first."
exit 1
elif [ ${#WHEEL_FILES[@]} -gt 1 ]; then
echo "Error: Multiple wheel files found:"
printf ' %s\n' "${WHEEL_FILES[@]}"
echo "Please clean up old wheels or specify which one to use."
exit 1
fi
WHEEL_PATH="${WHEEL_FILES[0]}"
if [ ! -f "$WHEEL_PATH" ]; then
echo "Error: Wheel not found at $WHEEL_PATH"
exit 1
fi
echo "Found wheel: $WHEEL_PATH"
echo "Creating test virtual environment..."
TEST_VENV=$(mktemp -d)/test-venv
python3 -m venv "$TEST_VENV"