1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-10 04:23:47 -05:00

Use Homebrew in Linux if Pyenv is installed with Homebrew or PYTHON_BUILD_USE_HOMEBREW is set

This commit is contained in:
Ivan Pozdeev
2024-02-19 01:38:02 +03:00
parent 9d8764f545
commit 05bb4f9a8d
3 changed files with 86 additions and 40 deletions

View File

@@ -118,8 +118,17 @@ is_mac() {
}
can_use_homebrew() {
[ -z "$PYTHON_BUILD_SKIP_HOMEBREW" ] || return 1
is_mac || return 1
[[ -n "$PYTHON_BUILD_USE_HOMEBREW" && -n "$PYTHON_BUILD_SKIP_HOMEBREW" ]] && {
echo "error: mutually exclusive environment variables PYTHON_BUILD_USE_HOMEBREW and PYTHON_BUILD_SKIP_HOMEBREW are set" >&3
exit 1
}
[[ -n "$PYTHON_BUILD_USE_HOMEBREW" ]] && return 0
[[ -n "$PYTHON_BUILD_SKIP_HOMEBREW" ]] && return 1
is_mac && return 0
# In Linux, if Pyenv itself is installed with Homebrew,
# we assume the user wants to take dependencies from there as well by default
command -v brew &>/dev/null && [[ $(abs_dirname "${BASH_SOURCE}") == "$(abs_dirname "$(brew --prefix 2>/dev/null ||true)")"/* ]] && return 0
return 1
}
# 9.1 -> 901