diff --git a/plugins/pyenv-binary/libexec/pyenv-binary-relocate b/plugins/pyenv-binary/libexec/pyenv-binary-relocate index 964ab543..d73f682d 100755 --- a/plugins/pyenv-binary/libexec/pyenv-binary-relocate +++ b/plugins/pyenv-binary/libexec/pyenv-binary-relocate @@ -43,7 +43,7 @@ if [ "$(uname -s)" = "Darwin" ]; then local load_commands install_ids rpaths dependency install_id rpath replacement load_commands="$(otool -L "$file")" - install_ids="$(otool -D "$file")" + install_ids="$(otool -D "$file" 2>/dev/null || true)" rpaths="$(otool -l "$file")" install_id="$(printf '%s\n' "$install_ids" | sed -n '2s/^[[:space:]]*//p')" diff --git a/plugins/pyenv-binary/test/generate-installer.bats b/plugins/pyenv-binary/test/generate-installer.bats index 74fdfe69..8c61edb3 100644 --- a/plugins/pyenv-binary/test/generate-installer.bats +++ b/plugins/pyenv-binary/test/generate-installer.bats @@ -137,7 +137,7 @@ create_meta() { create_stub uname 'case "$1" in -s) echo Darwin;; -m) echo arm64;; esac' create_path_executable install_name_tool true - PATH="${BATS_TEST_TMPDIR}/stubs:${PYENV_TEST_DIR}/bin:/bin" run bash "$out" + PATH="$(path_without otool)" run bash "$out" assert_failure "pyenv-binary: need otool to relocate the binary" } @@ -149,7 +149,7 @@ create_meta() { create_stub uname 'case "$1" in -s) echo Darwin;; -m) echo arm64;; esac' create_path_executable otool true - PATH="${BATS_TEST_TMPDIR}/stubs:${PYENV_TEST_DIR}/bin:/bin" run bash "$out" + PATH="$(path_without install_name_tool)" run bash "$out" assert_failure "pyenv-binary: need install_name_tool to relocate the binary" } @@ -165,6 +165,8 @@ create_meta() { cp "$archive" "${cache}/Python-3.12.7-binary.tar.gz" create_stub pyenv 'printf "argc=%s\narg1=%s\narg2=%s\narg3=%s\narg4=%s\n" "$#" "$1" "$2" "$3" "$4"' create_stub uname 'case "$1" in -s) echo Darwin;; -m) echo arm64;; esac' + create_stub sw_vers 'echo 15.5' + create_stub ldconfig true create_path_executable otool true create_path_executable install_name_tool true diff --git a/plugins/pyenv-binary/test/relocate.bats b/plugins/pyenv-binary/test/relocate.bats index bfac5d39..e14700b7 100644 --- a/plugins/pyenv-binary/test/relocate.bats +++ b/plugins/pyenv-binary/test/relocate.bats @@ -66,15 +66,18 @@ case "$1" in esac ;; -D ) - echo "${file}:" case "$file" in */lib/libpython3.12.dylib ) + echo "${file}:" if [ -n "$OTOOL_RELOCATED" ]; then echo '@rpath/libpython3.12.dylib' else echo "${old}/lib/libpython3.12.dylib" fi ;; + * ) + exit 1 + ;; esac ;; -l )