df
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled
This commit is contained in:
@@ -1,6 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Bootstrap script for POSIX (Linux/macOS) to create a Python venv and install the project.
|
# Bootstrap script for POSIX (Linux/macOS) to create a Python venv and install the project.
|
||||||
# Usage: scripts/bootstrap.sh [--editable] [--venv <path>] [--python <python>] [--desktop] [--no-install]
|
# Usage: scripts/bootstrap.sh [--editable] [--venv <path>] [--python <python>] [--desktop] [--no-install]
|
||||||
|
|
||||||
|
# Ensure script is running under Bash. Some users invoke this script with `sh` (dash)
|
||||||
|
# which does not support the Bash features used below (e.g., [[ ]], arrays, read -p).
|
||||||
|
# If not running under Bash, re-exec using a discovered bash binary.
|
||||||
|
if [ -z "${BASH_VERSION:-}" ]; then
|
||||||
|
if command -v bash >/dev/null 2>&1; then
|
||||||
|
echo "This script requires Bash; re-execing as 'bash $0'..."
|
||||||
|
exec bash "$0" "$@"
|
||||||
|
else
|
||||||
|
echo "ERROR: This script requires Bash. Please run with 'bash $0' or install Bash." >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
VENV_PATH=".venv"
|
VENV_PATH=".venv"
|
||||||
@@ -60,6 +74,17 @@ fi
|
|||||||
|
|
||||||
echo "Using Python: $PY"
|
echo "Using Python: $PY"
|
||||||
|
|
||||||
|
# Operate from the repository root (parent of the scripts dir) so relative
|
||||||
|
# operations (like creating the venv and pip install) act on the project root
|
||||||
|
# regardless of where this script was invoked from.
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
REPO="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||||
|
if ! cd "$REPO"; then
|
||||||
|
echo "ERROR: Failed to change to repo root: $REPO" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
echo "Operating from repo root: $REPO"
|
||||||
|
|
||||||
if [[ -d "$VENV_PATH" ]]; then
|
if [[ -d "$VENV_PATH" ]]; then
|
||||||
# Detect whether the existing venv has a working python executable
|
# Detect whether the existing venv has a working python executable
|
||||||
VENV_PY=""
|
VENV_PY=""
|
||||||
@@ -119,10 +144,10 @@ if [[ "$NOINSTALL" != "true" ]]; then
|
|||||||
|
|
||||||
if [[ "$EDITABLE" == "true" ]]; then
|
if [[ "$EDITABLE" == "true" ]]; then
|
||||||
echo "Installing project in editable mode..."
|
echo "Installing project in editable mode..."
|
||||||
"$VENV_PY" -m pip install -e .
|
"$VENV_PY" -m pip install -e "$REPO"
|
||||||
else
|
else
|
||||||
echo "Installing project..."
|
echo "Installing project..."
|
||||||
"$VENV_PY" -m pip install .
|
"$VENV_PY" -m pip install "$REPO"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify the installed CLI module can be imported. This helps catch packaging
|
# Verify the installed CLI module can be imported. This helps catch packaging
|
||||||
|
|||||||
Reference in New Issue
Block a user