Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions .cursor/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,37 @@ persist_sdlc_engine_path() {
done
}

# Cloud build images often ship python3.12 without the Debian venv/ensurepip
# split package; setup-engine-venv.sh needs both.
ensure_python312_and_venv() {
if [[ "${SDLC_INSTALL_SKIP_SYSTEM_DEPS:-}" == "1" ]]; then
if ! command -v python3.12 >/dev/null 2>&1; then
echo "error: python3.12 is required for sdlc-engine" >&2
exit 1
fi
return 0
fi
local missing=() probe
if ! command -v python3.12 >/dev/null 2>&1; then
missing+=(python3.12)
else
probe="$(mktemp -d)"
if ! python3.12 -m venv "${probe}" >/dev/null 2>&1; then
missing+=(python3.12-venv)
fi
rm -rf "${probe}"
fi
if ((${#missing[@]} == 0)); then
return 0
fi
if ! command -v sudo >/dev/null 2>&1; then
echo "error: required packages missing: ${missing[*]}" >&2
exit 1
fi
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "${missing[@]}"
}

# Real checkouts must leave git, gh, repository sdlc.sh, and pytest usable.
# Stub proving tests omit scripts/sdlc.sh and engine/pyproject.toml.
# Long-running processes stay out of install (use start or terminals).
Expand Down Expand Up @@ -72,19 +103,7 @@ fi

cd "${ROOT}"

if ! command -v python3.12 >/dev/null 2>&1; then
if [[ "${SDLC_INSTALL_SKIP_SYSTEM_DEPS:-}" == "1" ]]; then
echo "error: python3.12 is required for sdlc-engine" >&2
exit 1
fi
if command -v sudo >/dev/null 2>&1; then
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3.12 python3.12-venv
else
echo "error: python3.12 is required for sdlc-engine" >&2
exit 1
fi
fi
ensure_python312_and_venv

"${ROOT}/scripts/setup-engine-venv.sh"

Expand Down
1 change: 1 addition & 0 deletions tests/test-cloud-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ else
fi

assert_contains "${INSTALL_SH}" "setup-engine-venv.sh" "install.sh calls setup-engine-venv.sh"
assert_contains "${INSTALL_SH}" "python3.12-venv" "install.sh ensures python3.12-venv when venv creation fails"
assert_contains "${INSTALL_SH}" "sdlc-engine" "install.sh verifies sdlc-engine"
assert_contains "${INSTALL_SH}" "scripts/sdlc.sh" "install.sh checks repository sdlc.sh"
assert_contains "${INSTALL_SH}" "pytest" "install.sh checks pytest from the dev extra"
Expand Down
Loading