diff --git a/Makefile b/Makefile index ebc7e2373..9d732065b 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/scripts/clusterlib_reinstall_editable.sh b/scripts/reinstall_editable.sh similarity index 58% rename from scripts/clusterlib_reinstall_editable.sh rename to scripts/reinstall_editable.sh index a1e1fbca6..16ba69ff5 100755 --- a/scripts/clusterlib_reinstall_editable.sh +++ b/scripts/reinstall_editable.sh @@ -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 @@ -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__)'