mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Add envvar to skip Homebrew
This commit is contained in:
parent
cfe684ef42
commit
e6446555f3
3 changed files with 43 additions and 11 deletions
|
@ -113,6 +113,7 @@ You can set certain environment variables to control the build process.
|
||||||
checksum of the file to the mirror URL.
|
checksum of the file to the mirror URL.
|
||||||
* `PYTHON_BUILD_SKIP_MIRROR`, if set, forces python-build to download packages from
|
* `PYTHON_BUILD_SKIP_MIRROR`, if set, forces python-build to download packages from
|
||||||
their original source URLs instead of using a mirror.
|
their original source URLs instead of using a mirror.
|
||||||
|
* `PYTHON_BUILD_SKIP_HOMEBREW`, if set, will not search for libraries installed by Homebrew on macOS.
|
||||||
* `PYTHON_BUILD_ROOT` overrides the default location from where build definitions
|
* `PYTHON_BUILD_ROOT` overrides the default location from where build definitions
|
||||||
in `share/python-build/` are looked up.
|
in `share/python-build/` are looked up.
|
||||||
* `PYTHON_BUILD_DEFINITIONS` can be a list of colon-separated paths that get
|
* `PYTHON_BUILD_DEFINITIONS` can be a list of colon-separated paths that get
|
||||||
|
|
|
@ -112,6 +112,11 @@ is_mac() {
|
||||||
[ $# -eq 0 ] || [ "$(osx_version)" "$@" ]
|
[ $# -eq 0 ] || [ "$(osx_version)" "$@" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
can_use_homebrew() {
|
||||||
|
[ -z "$PYTHON_BUILD_SKIP_HOMEBREW" ] || return 1
|
||||||
|
is_mac || return 1
|
||||||
|
}
|
||||||
|
|
||||||
# 9.1 -> 901
|
# 9.1 -> 901
|
||||||
# 10.9 -> 1009
|
# 10.9 -> 1009
|
||||||
# 10.10 -> 1010
|
# 10.10 -> 1010
|
||||||
|
@ -1322,7 +1327,7 @@ configured_with_package_dir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
use_homebrew() {
|
use_homebrew() {
|
||||||
is_mac || return 1
|
can_use_homebrew || return 1
|
||||||
# unless Homebrew is at the default /usr/local, need to add its paths to
|
# 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
|
# compiler search to be able to use non-keg-only deps from there
|
||||||
if is_mac && command -v brew &>/dev/null; then
|
if is_mac && command -v brew &>/dev/null; then
|
||||||
|
@ -1344,7 +1349,7 @@ needs_yaml() {
|
||||||
}
|
}
|
||||||
|
|
||||||
use_homebrew_yaml() {
|
use_homebrew_yaml() {
|
||||||
is_mac || return 1
|
can_use_homebrew || return 1
|
||||||
local libdir="$(brew --prefix libyaml 2>/dev/null || true)"
|
local libdir="$(brew --prefix libyaml 2>/dev/null || true)"
|
||||||
if [ -d "$libdir" ]; then
|
if [ -d "$libdir" ]; then
|
||||||
echo "python-build: use libyaml from homebrew"
|
echo "python-build: use libyaml from homebrew"
|
||||||
|
@ -1388,7 +1393,7 @@ has_broken_mac_readline() {
|
||||||
}
|
}
|
||||||
|
|
||||||
use_homebrew_readline() {
|
use_homebrew_readline() {
|
||||||
is_mac || return 1
|
can_use_homebrew || return 1
|
||||||
if ! configured_with_package_dir "python" "readline/rlconf.h"; then
|
if ! configured_with_package_dir "python" "readline/rlconf.h"; then
|
||||||
local libdir="$(brew --prefix readline 2>/dev/null || true)"
|
local libdir="$(brew --prefix readline 2>/dev/null || true)"
|
||||||
if [ -d "$libdir" ]; then
|
if [ -d "$libdir" ]; then
|
||||||
|
@ -1429,7 +1434,7 @@ has_broken_mac_openssl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
use_homebrew_openssl() {
|
use_homebrew_openssl() {
|
||||||
is_mac || return 1
|
can_use_homebrew || return 1
|
||||||
command -v brew >/dev/null || return 1
|
command -v brew >/dev/null || return 1
|
||||||
for openssl in ${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl}; do
|
for openssl in ${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl}; do
|
||||||
local ssldir="$(brew --prefix "${openssl}" || true)"
|
local ssldir="$(brew --prefix "${openssl}" || true)"
|
||||||
|
@ -1529,7 +1534,7 @@ build_package_verify_openssl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
use_homebrew_zlib() {
|
use_homebrew_zlib() {
|
||||||
is_mac || return 1
|
can_use_homebrew || return 1
|
||||||
local brew_zlib="$(brew --prefix zlib 2>/dev/null || true)"
|
local brew_zlib="$(brew --prefix zlib 2>/dev/null || true)"
|
||||||
if [ -d "$brew_zlib" ]; then
|
if [ -d "$brew_zlib" ]; then
|
||||||
echo "python-build: use zlib from homebrew"
|
echo "python-build: use zlib from homebrew"
|
||||||
|
@ -1549,7 +1554,7 @@ use_xcode_sdk_zlib() {
|
||||||
}
|
}
|
||||||
|
|
||||||
use_homebrew_tcltk() {
|
use_homebrew_tcltk() {
|
||||||
is_mac || return 1
|
can_use_homebrew || return 1
|
||||||
# get the version from the folder that homebrew versions
|
# get the version from the folder that homebrew versions
|
||||||
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)"
|
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)"
|
||||||
if [ -d "$tcltk_libdir" ]; then
|
if [ -d "$tcltk_libdir" ]; then
|
||||||
|
@ -1607,7 +1612,7 @@ get_tcltk_flag_from() {
|
||||||
}
|
}
|
||||||
|
|
||||||
use_tcltk() {
|
use_tcltk() {
|
||||||
if is_mac; then
|
if can_use_homebrew; then
|
||||||
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)"
|
local tcltk_libdir="$(brew --prefix tcl-tk 2>/dev/null || true)"
|
||||||
fi
|
fi
|
||||||
local tcl_tk_libs="$(get_tcltk_flag_from "$PYTHON_CONFIGURE_OPTS")"
|
local tcl_tk_libs="$(get_tcltk_flag_from "$PYTHON_CONFIGURE_OPTS")"
|
||||||
|
|
|
@ -283,6 +283,32 @@ make install
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "no library searches performed during normal operation touch homebrew if envvar is set" {
|
||||||
|
cached_tarball "Python-3.6.2"
|
||||||
|
|
||||||
|
for i in {1..4}; do stub uname '-s : echo Darwin'; done
|
||||||
|
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
|
||||||
|
stub brew true; brew
|
||||||
|
stub_make_install
|
||||||
|
export PYTHON_BUILD_SKIP_HOMEBREW=1
|
||||||
|
|
||||||
|
run_inline_definition <<DEF
|
||||||
|
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
|
||||||
|
DEF
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
unstub uname
|
||||||
|
unstub brew
|
||||||
|
unstub make
|
||||||
|
|
||||||
|
assert_build_log <<OUT
|
||||||
|
Python-3.6.2: CPPFLAGS="-I${TMP}/install/include " LDFLAGS="-L${TMP}/install/lib "
|
||||||
|
Python-3.6.2: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
|
||||||
|
make -j 2
|
||||||
|
make install
|
||||||
|
OUT
|
||||||
|
}
|
||||||
|
|
||||||
@test "readline is not linked from Homebrew when explicitly defined" {
|
@test "readline is not linked from Homebrew when explicitly defined" {
|
||||||
cached_tarball "Python-3.6.2"
|
cached_tarball "Python-3.6.2"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue