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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ update-node-bins:
fi
@./scripts/update_node_bins.sh "$(repo)"

# reinstall cardano-clusterlib-py in editable mode from a given git repository
# reinstall python package in editable mode from a given git repository
.PHONY: reinstall-editable
reinstall-editable:
@if [ -z "$(repo)" ]; then \
echo "Usage: make reinstall-editable repo=/path/to/cardano-clusterlib-py" >&2; \
echo "Usage: make reinstall-editable repo=/path/to/package_root" >&2; \
exit 1; \
fi
@./scripts/clusterlib_reinstall_editable.sh "$(repo)"
@./scripts/reinstall_editable.sh "$(repo)"

# set up test environment
.PHONY: test-env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
set -euo pipefail

err() { printf "Error: %s\n" "$*" >&2; }
usage() { printf "Usage: %s /path/to/cardano-clusterlib-py\n" "${0}"; }
usage() { printf "Usage: %s /path/to/package_root\n" "${0}"; }

if [ $# -ne 1 ]; then
usage
usage >&2
exit 2
fi
REPO_PATH="$(readlink -m "$1")"

TOP_DIR="$(readlink -m "${0%/*}/..")"
cd "$TOP_DIR" >/dev/null
cd "$TOP_DIR"

# Activate python virtual environment
if [ -z "${VIRTUAL_ENV:-}" ]; then
Expand Down Expand Up @@ -43,30 +43,16 @@ then
exit 1
fi

# Check that cardano-clusterlib is installed
if ! uv pip show cardano-clusterlib >/dev/null 2>&1; then
err "Package 'cardano-clusterlib' is not installed in this environment."
exit 1
fi

# Validate repo path
if [ ! -d "$REPO_PATH" ]; then
err "Repo path not found: $REPO_PATH"
exit 1
fi
if [[ ! -f "$REPO_PATH/pyproject.toml" && ! -f "$REPO_PATH/cardano_clusterlib" ]]; then
err "Given path doesn't look like the cardano-clusterlib-py repo."
if [[ ! -f "$REPO_PATH/pyproject.toml" && ! -f "$REPO_PATH/setup.cfg" && ! -f "$REPO_PATH/setup.py" ]]; then
err "Given path doesn't look like python package."
exit 1
fi

echo "Uninstalling 'cardano-clusterlib' from current environment..."
uv pip uninstall cardano-clusterlib

echo "Installing editable from: $REPO_PATH"
cd "$REPO_PATH" >/dev/null
cd "$REPO_PATH"
uv pip install -e . --config-setting editable_mode=compat

echo
echo "Verifying editable install (should point into your repo, not site-packages):"
cd "$TOP_DIR" >/dev/null
python -c 'from cardano_clusterlib import clusterlib_klass; print(clusterlib_klass.__file__)'