Skip to content
Merged
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
23 changes: 11 additions & 12 deletions installers/install-python-microscopy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,26 @@ if ! command -v uv &>/dev/null; then
fi
fi

# --- Standalone Python installation via py-app-standalone ---
echo "==> Creating standalone Python installation..."
uv tool run py-app-standalone --python-version "$TARGET_PYTHON" --target "$DEST" --force "$PACKAGE_NAME"
# --- Managed Python ---
uv python install "$TARGET_PYTHON"

# --- Normalize cpython-* to a stable directory name ---
PYTHON_DIRS=( "$DEST"/cpython-* )
[[ -d "${PYTHON_DIRS[0]}" ]] || { echo "ERROR: standalone Python directory not found" >&2; exit 1; }
mv "${PYTHON_DIRS[0]}" "$DEST/python"
# Remove the bare-venv temp directory that py-app-standalone leaves behind.
rm -rf "$DEST/bare-venv"
# --- Virtual environment ---
uv venv --python "$TARGET_PYTHON" "$DEST/venv"

# --- Install PYME from pip ---
echo "==> Installing $PACKAGE_NAME..."
uv pip install --python "$DEST/venv/bin/python" "$PACKAGE_NAME"

# --- Top-level entry point symlinks ---
for ep in "${ENTRY_POINTS[@]}"; do
ln -sf "$DEST/python/bin/$ep" "$DEST/$ep"
ln -sf "$DEST/venv/bin/$ep" "$DEST/$ep"
done

# --- Shell helper (adds python/bin to PATH) ---
# --- Activated-shell helper ---
cat > "$DEST/pyme-shell" <<'SHELL_SCRIPT'
#!/usr/bin/env bash
PYME_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export PATH="$PYME_DIR/python/bin:$PATH"
source "$PYME_DIR/venv/bin/activate"
exec "${SHELL:-bash}"
SHELL_SCRIPT
chmod +x "$DEST/pyme-shell"
Expand Down
Loading