This commit is contained in:
2025-12-31 22:58:54 -08:00
parent 977381b636
commit 7002075947
9 changed files with 344 additions and 17 deletions

View File

@@ -236,7 +236,7 @@ if [[ "$EUID" -eq 0 ]]; then
fi
# Basic sanity check: ensure the detected repo root actually looks like the project
if [[ ! -f "$REPO/pyproject.toml" && ! -f "$REPO/setup.py" && ! -f "$REPO/CLI.py" ]]; then
if [[ ! -f "$REPO/pyproject.toml" && ! -f "$REPO/scripts/pyproject.toml" && ! -f "$REPO/setup.py" && ! -f "$REPO/CLI.py" ]]; then
echo "WARNING: Detected repo root ($REPO) does not contain pyproject.toml, setup.py, or CLI.py; attempting to locate project root via git or current working directory..." >&2
if git -C "$SCRIPT_DIR/.." rev-parse --show-toplevel >/dev/null 2>&1; then
REPO="$(git -C "$SCRIPT_DIR/.." rev-parse --show-toplevel)"
@@ -323,10 +323,10 @@ if [[ "$NOINSTALL" != "true" ]]; then # If not explicitly requested, auto-selec
if [[ "$EDITABLE" == "true" ]]; then
echo "Installing project in editable mode..."
"$VENV_PY" -m pip install -e "$REPO"
"$VENV_PY" -m pip install -e "$REPO/scripts"
else
echo "Installing project..."
"$VENV_PY" -m pip install "$REPO"
"$VENV_PY" -m pip install "$REPO/scripts"
fi
# Verify the installed CLI module can be imported. This helps catch packaging
@@ -386,7 +386,7 @@ PY
else
echo "WARNING: Could not import 'medeia_macina.cli_entry' from the venv." >&2
echo "Action: Try running: $VENV_PY -m pip install -e . or inspect the venv site-packages to verify the installation." >&2
echo "Action: Try running: $VENV_PY -m pip install -e \"$REPO/scripts\" or inspect the venv site-packages to verify the installation." >&2
fi
echo "Verifying environment for known issues (urllib3 compatibility)..."
@@ -578,7 +578,7 @@ set -e
# but prefer to discover a repo from the current working directory or git.
REPO="__REPO__"
# If the placeholder does not appear to point at a repo, attempt discovery.
if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ]; then
if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ] && [ ! -f "$REPO/scripts/pyproject.toml" ]; then
# First try to find a git toplevel from the current working directory.
if command -v git >/dev/null 2>&1; then
gitroot=$(git -C "$(pwd -P)" rev-parse --show-toplevel 2>/dev/null || true)
@@ -588,10 +588,10 @@ if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ]; then
fi
fi
# If still unresolved, walk up from the CWD looking for signs of the project.
if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ]; then
if [ ! -f "$REPO/CLI.py" ] && [ ! -f "$REPO/pyproject.toml" ] && [ ! -f "$REPO/scripts/pyproject.toml" ]; then
CUR="$(pwd -P)"
while [ "$CUR" != "/" ] && [ "$CUR" != "" ]; do
if [ -f "$CUR/CLI.py" ] || [ -f "$CUR/pyproject.toml" ]; then
if [ -f "$CUR/CLI.py" ] || [ -f "$CUR/pyproject.toml" ] || [ -f "$CUR/scripts/pyproject.toml" ]; then
REPO="$CUR"
break
fi