1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-11 13:03:46 -05:00

Don't use Homebrew outside of MacOS

In Linux, it's not the primary source of packages and
cannot be used without build flag adjustments
thus has caused build failures.
This commit is contained in:
Ivan Pozdeev
2022-02-09 18:55:23 +03:00
parent e928e75f22
commit 65316a7e99
4 changed files with 118 additions and 64 deletions

View File

@@ -1322,9 +1322,10 @@ configured_with_package_dir() {
}
use_homebrew() {
is_mac || return 1
# unless Homebrew is at the default /usr/local, need to add its paths to
# compiler search to be able to use non-keg-only deps from there
if command -v brew &>/dev/null; then
if is_mac && command -v brew &>/dev/null; then
local brew_prefix="$(brew --prefix 2>/dev/null || true)"
# /usr/local/lib:/usr/lib is the default library search path
if [[ -n $brew_prefix && $brew_prefix != "/usr" && $brew_prefix != "/usr/local" ]]; then
@@ -1340,6 +1341,7 @@ needs_yaml() {
}
use_homebrew_yaml() {
is_mac || return 1
local libdir="$(brew --prefix libyaml 2>/dev/null || true)"
if [ -d "$libdir" ]; then
echo "python-build: use libyaml from homebrew"
@@ -1383,6 +1385,7 @@ has_broken_mac_readline() {
}
use_homebrew_readline() {
is_mac || return 1
if ! configured_with_package_dir "python" "readline/rlconf.h"; then
local libdir="$(brew --prefix readline 2>/dev/null || true)"
if [ -d "$libdir" ]; then
@@ -1423,6 +1426,7 @@ has_broken_mac_openssl() {
}
use_homebrew_openssl() {
is_mac || return 1
command -v brew >/dev/null || return 1
for openssl in ${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl}; do
local ssldir="$(brew --prefix "${openssl}" || true)"
@@ -1522,6 +1526,7 @@ build_package_verify_openssl() {
}
use_homebrew_zlib() {
is_mac || return 1
local brew_zlib="$(brew --prefix zlib 2>/dev/null || true)"
if [ -d "$brew_zlib" ]; then
echo "python-build: use zlib from homebrew"
@@ -1541,6 +1546,7 @@ use_xcode_sdk_zlib() {
}
use_homebrew_tcltk() {
is_mac || return 1
# get the version from the folder that homebrew versions
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)"
if [ -d "$tcltk_libdir" ]; then
@@ -1598,7 +1604,9 @@ get_tcltk_flag_from() {
}
use_tcltk() {
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)"
if is_mac; then
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)"
fi
local tcl_tk_libs="$(get_tcltk_flag_from "$PYTHON_CONFIGURE_OPTS")"
# if tcltk_ops_flag is in PYTHON_CONFIGURE_OPTS, use user provided tcltk