mirror of
https://github.com/pyenv/pyenv.git
synced 2025-12-07 18:38:40 +00:00
Merge 69c96493ac into 44172d69f2
This commit is contained in:
commit
ecf3df75a2
@ -128,13 +128,39 @@ can_use_homebrew() {
|
||||
}
|
||||
[[ -n "$PYTHON_BUILD_USE_HOMEBREW" ]] && return 0
|
||||
[[ -n "$PYTHON_BUILD_SKIP_HOMEBREW" ]] && return 1
|
||||
is_mac && return 0
|
||||
is_mac && command -v brew &>/dev/null && 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
|
||||
}
|
||||
|
||||
can_use_macports() {
|
||||
[[ -n "$PYTHON_BUILD_USE_MACPORTS" && -n "$PYTHON_BUILD_SKIP_MACPORTS" ]] && {
|
||||
echo "error: mutually exclusive environment variables PYTHON_BUILD_USE_MACPORTS and PYTHON_BUILD_SKIP_MACPORTS are set" >&3
|
||||
exit 1
|
||||
}
|
||||
[[ -n "$PYTHON_BUILD_USE_MACPORTS" ]] && return 0
|
||||
[[ -n "$PYTHON_BUILD_SKIP_MACPORTS" ]] && return 1
|
||||
command -v port &>/dev/null && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
is_homebrew_preferred() {
|
||||
can_use_homebrew || return 1
|
||||
[ -n "$PYTHON_BUILD_USE_HOMEBREW" ] && return 0
|
||||
local brew_path port_path path paths
|
||||
command -v port &>/dev/null && port_path=$(dirname "$(command -v port)")
|
||||
[ -z "$port_path" ] && return 0
|
||||
[ -n "$PYTHON_BUILD_USE_MACPORTS" ] && return 1
|
||||
command -v brew &>/dev/null && brew_path=$(dirname "$(command -v brew)")
|
||||
[ -z "$brew_path" ] && return 1
|
||||
# Homebrew and MacPorts found in PATH
|
||||
# find out what to use based on the PATH order
|
||||
[[ $PATH == *$brew_path*":"*$port_path* ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
# 9.1 -> 901
|
||||
# 10.9 -> 1009
|
||||
# 10.10 -> 1010
|
||||
@ -815,14 +841,28 @@ build_package_standard_build() {
|
||||
local PACKAGE_LDFLAGS="${package_var_name}_LDFLAGS"
|
||||
|
||||
if [ "$package_var_name" = "PYTHON" ]; then
|
||||
use_homebrew || true
|
||||
use_custom_tcltk || use_homebrew_tcltk || true
|
||||
use_homebrew_readline || use_freebsd_pkg || true
|
||||
use_homebrew_ncurses || true
|
||||
if is_mac -ge 1014; then
|
||||
use_xcode_sdk_zlib || use_homebrew_zlib || true
|
||||
if is_homebrew_preferred; then
|
||||
use_homebrew || true
|
||||
use_custom_tcltk || use_homebrew_tcltk || true
|
||||
use_homebrew_readline || true
|
||||
use_homebrew_ncurses || true
|
||||
if is_mac -ge 1014; then
|
||||
use_xcode_sdk_zlib || use_homebrew_zlib || true
|
||||
else
|
||||
use_homebrew_zlib || true
|
||||
fi
|
||||
elif can_use_macports; then
|
||||
use_macports || true
|
||||
use_custom_tcltk || true
|
||||
use_macports_readline || true
|
||||
use_macports_ncurses || true
|
||||
if is_mac -ge 1014; then
|
||||
use_xcode_sdk_zlib || use_macports_zlib || true
|
||||
else
|
||||
use_macports_zlib || true
|
||||
fi
|
||||
else
|
||||
use_homebrew_zlib || true
|
||||
use_freebsd_pkg || true
|
||||
fi
|
||||
use_dsymutil || true
|
||||
use_free_threading || true
|
||||
@ -1438,9 +1478,24 @@ use_homebrew() {
|
||||
fi
|
||||
}
|
||||
|
||||
use_macports() {
|
||||
can_use_macports || return 1
|
||||
local port_location="$(command -v port)"
|
||||
if [ -n "$port_location" ]; then
|
||||
local prefix="${port_location%/bin/port}"
|
||||
export CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }-I${prefix}/include"
|
||||
append_ldflags_libs "-L${prefix}/lib -Wl,-rpath,${prefix}/lib"
|
||||
fi
|
||||
}
|
||||
|
||||
needs_yaml() {
|
||||
! configured_with_package_dir "python" "yaml.h" &&
|
||||
! use_homebrew_yaml
|
||||
if ! configured_with_package_dir "python" "yaml.h"; then
|
||||
if is_homebrew_preferred; then
|
||||
use_homebrew_yaml && return 1
|
||||
elif can_use_macports; then
|
||||
use_macports_yaml && return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
use_homebrew_yaml() {
|
||||
@ -1455,6 +1510,21 @@ use_homebrew_yaml() {
|
||||
fi
|
||||
}
|
||||
|
||||
use_macports_yaml() {
|
||||
can_use_macports || return 1
|
||||
local prefix="$(port -q location libyaml 2>/dev/null || true)"
|
||||
if [ -n "$prefix" ]; then
|
||||
local libdir="$prefix/opt/local"
|
||||
if [ -d "$libdir" ]; then
|
||||
echo "python-build: use libyaml from MacPorts"
|
||||
export CPPFLAGS="-I$libdir/include${CPPFLAGS:+ $CPPFLAGS}"
|
||||
export LDFLAGS="-L$libdir/lib${LDFLAGS:+ ${LDFLAGS% }}"
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
use_freebsd_pkg() {
|
||||
# check if FreeBSD
|
||||
if [ "FreeBSD" = "$(uname -s)" ]; then
|
||||
@ -1488,9 +1558,13 @@ use_freebsd_pkg() {
|
||||
has_broken_mac_readline() {
|
||||
# Mac OS X 10.4 has broken readline.
|
||||
# https://github.com/pyenv/pyenv/issues/23
|
||||
is_mac &&
|
||||
! configured_with_package_dir "python" "readline/rlconf.h" &&
|
||||
! use_homebrew_readline
|
||||
if is_mac && ! configured_with_package_dir "python" "readline/rlconf.h"; then
|
||||
if is_homebrew_preferred; then
|
||||
use_homebrew_readline && return 1
|
||||
elif can_use_macports; then
|
||||
use_macports_readline && return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
use_homebrew_readline() {
|
||||
@ -1507,6 +1581,23 @@ use_homebrew_readline() {
|
||||
fi
|
||||
}
|
||||
|
||||
use_macports_readline() {
|
||||
can_use_macports || return 1
|
||||
if ! configured_with_package_dir "python" "readline/rlconf.h"; then
|
||||
local prefix="$(port -q location readline 2>/dev/null || true)"
|
||||
if [ -n "$prefix" ]; then
|
||||
local libdir="$prefix/opt/local"
|
||||
if [ -d "$libdir" ]; then
|
||||
echo "python-build: use readline from MacPorts"
|
||||
export CPPFLAGS="-I$libdir/include${CPPFLAGS:+ $CPPFLAGS}"
|
||||
export LDFLAGS="-L$libdir/lib${LDFLAGS:+ $LDFLAGS}"
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
use_homebrew_ncurses() {
|
||||
can_use_homebrew || return 1
|
||||
local libdir="$(brew --prefix ncurses 2>/dev/null || true)"
|
||||
@ -1519,6 +1610,21 @@ use_homebrew_ncurses() {
|
||||
fi
|
||||
}
|
||||
|
||||
use_macports_ncurses() {
|
||||
can_use_macports || return 1
|
||||
local prefix="$(port -q location ncurses 2>/dev/null || true)"
|
||||
if [[ -n "$prefix" ]]; then
|
||||
local libdir="$prefix/opt/local"
|
||||
if [ -d "$libdir" ]; then
|
||||
echo "python-build: use ncurses from MacPorts"
|
||||
export CPPFLAGS="-I$libdir/include${CPPFLAGS:+ $CPPFLAGS}"
|
||||
export LDFLAGS="-L$libdir/lib${LDFLAGS:+ $LDFLAGS}"
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
prefer_openssl11() {
|
||||
# Allow overriding the preference of OpenSSL version per definition basis (#1302, #1325, #1326)
|
||||
PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@1.1 openssl}"
|
||||
@ -1548,8 +1654,13 @@ build_package_mac_readline() {
|
||||
has_broken_mac_openssl() {
|
||||
is_mac || return 1
|
||||
local openssl_version="$(/usr/bin/openssl version 2>/dev/null || true)"
|
||||
[[ $openssl_version = "OpenSSL 0.9.8"?* || $openssl_version = "LibreSSL"* ]] &&
|
||||
! use_homebrew_openssl
|
||||
if [[ $openssl_version = "OpenSSL 0.9.8"?* || $openssl_version = "LibreSSL"* ]]; then
|
||||
if is_homebrew_preferred; then
|
||||
use_homebrew_openssl && return 1
|
||||
elif can_use_macports; then
|
||||
use_macports_openssl && return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
use_homebrew_openssl() {
|
||||
@ -1574,6 +1685,31 @@ use_homebrew_openssl() {
|
||||
return 1
|
||||
}
|
||||
|
||||
use_macports_openssl() {
|
||||
can_use_macports || return 1
|
||||
command -v port >/dev/null || return 1
|
||||
for openssl in ${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl}; do
|
||||
local ssldir="$(port -q location "${openssl}" 2>/dev/null || true)"
|
||||
if [ -n "$ssldir" ]; then
|
||||
ssldir="${ssldir}/opt/local"
|
||||
if [ -d "$ssldir" ]; then
|
||||
echo "python-build: use ${openssl} from MacPorts"
|
||||
if [[ -n "${PYTHON_BUILD_CONFIGURE_WITH_OPENSSL:-}" ]]; then
|
||||
# configure script of newer CPython versions support `--with-openssl`
|
||||
# https://bugs.python.org/issue21541
|
||||
package_option python configure --with-openssl="${ssldir}"
|
||||
else
|
||||
export CPPFLAGS="-I$ssldir/include ${CPPFLAGS:+ $CPPFLAGS}"
|
||||
export LDFLAGS="-L$ssldir/lib${LDFLAGS:+ $LDFLAGS}"
|
||||
fi
|
||||
fi
|
||||
export PKG_CONFIG_PATH="$ssldir/lib/pkgconfig/:${PKG_CONFIG_PATH}"
|
||||
return
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
build_package_mac_openssl() {
|
||||
# Install to a subdirectory since we don't want shims for bin/openssl.
|
||||
OPENSSL_PREFIX_PATH="${PREFIX_PATH}/openssl"
|
||||
@ -1687,6 +1823,21 @@ use_xcode_sdk_zlib() {
|
||||
fi
|
||||
}
|
||||
|
||||
use_macports_zlib() {
|
||||
can_use_macports || return 1
|
||||
local prefix="$(port -q location zlib 2>/dev/null || true)"
|
||||
if [[ -n "$prefix" ]]; then
|
||||
local libdir="$prefix/opt/local"
|
||||
if [[ -d "$libdir" ]]; then
|
||||
echo "python-build: use zlib from MacPorts"
|
||||
export CPPFLAGS="-I$prefix/include ${CPPFLAGS}"
|
||||
export LDFLAGS="-L$prefix/lib ${LDFLAGS}"
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
use_homebrew_tcltk() {
|
||||
can_use_homebrew || return 1
|
||||
# Since https://github.com/Homebrew/homebrew-core/commit/f10e88617b41555193c22fdcba6109fe82155ee2 (10.11.2024),
|
||||
|
||||
@ -62,8 +62,7 @@ assert_build_log() {
|
||||
cached_tarball "yaml-0.1.6"
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..10}; do stub uname '-s : echo Linux'; done
|
||||
stub brew false
|
||||
for i in {1..5}; do stub uname '-s : echo Linux'; done
|
||||
stub_make_install
|
||||
stub_make_install
|
||||
|
||||
@ -104,8 +103,7 @@ OUT
|
||||
cached_tarball "yaml-0.1.6" "$yaml_configure"
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..10}; do stub uname '-s : echo Linux'; done
|
||||
stub brew false
|
||||
for i in {1..5}; do stub uname '-s : echo Linux'; done
|
||||
stub_make_install
|
||||
stub_make_install "$PYTHON_MAKE_INSTALL_TARGET"
|
||||
|
||||
@ -132,8 +130,7 @@ OUT
|
||||
cached_tarball "yaml-0.1.6"
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..10}; do stub uname '-s : echo Linux'; done
|
||||
stub brew false
|
||||
for i in {1..5}; do stub uname '-s : echo Linux'; done
|
||||
stub_make_install
|
||||
stub_make_install
|
||||
stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'
|
||||
@ -162,8 +159,7 @@ OUT
|
||||
cached_tarball "yaml-0.1.6"
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..10}; do stub uname '-s : echo Linux'; done
|
||||
stub brew false
|
||||
for i in {1..5}; do stub uname '-s : echo Linux'; done
|
||||
stub_make_install
|
||||
stub_make_install
|
||||
stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'
|
||||
@ -188,6 +184,135 @@ make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "Homebrew is used when brew is before port in PATH" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
BREW_PREFIX="$TMP/homebrew-prefix"
|
||||
mkdir -p "$BREW_PREFIX/bin"
|
||||
PORT_PREFIX="$TMP/macports-prefix"
|
||||
mkdir -p "$PORT_PREFIX/bin"
|
||||
|
||||
for i in {1..9}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
|
||||
stub brew "--prefix : echo '$BREW_PREFIX'"
|
||||
for i in {1..5}; do stub brew false; done
|
||||
stub_make_install
|
||||
export PATH="$BREW_PREFIX/bin:$PORT_PREFIX/bin:$PATH"
|
||||
|
||||
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 sw_vers
|
||||
unstub brew
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${TMP}/install/include -I$BREW_PREFIX/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib -L$BREW_PREFIX/lib -Wl,-rpath,$BREW_PREFIX/lib" PKG_CONFIG_PATH=""
|
||||
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "MacPorts is used over Homebrew when both present and port is first in PATH" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
BREW_PREFIX="$TMP/homebrew-prefix"
|
||||
mkdir -p "$BREW_PREFIX/bin"
|
||||
PORT_PREFIX=$TMP
|
||||
|
||||
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
|
||||
for i in {1..3}; do stub port false; done
|
||||
stub_make_install
|
||||
export PATH="$PORT_PREFIX/bin:$BREW_PREFIX/bin:$PATH"
|
||||
|
||||
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 sw_vers
|
||||
unstub port
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${TMP}/install/include -I$PORT_PREFIX/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib -L$PORT_PREFIX/lib -Wl,-rpath,$PORT_PREFIX/lib" PKG_CONFIG_PATH=""
|
||||
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "Non-empty PYTHON_BUILD_USE_HOMEBREW overrides PATH order selection" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
BREW_PREFIX="$TMP/homebrew-prefix"
|
||||
mkdir -p "$BREW_PREFIX/bin"
|
||||
PORT_PREFIX=$TMP
|
||||
|
||||
for i in {1..3}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
|
||||
stub brew "--prefix : echo '$BREW_PREFIX'"
|
||||
for i in {1..5}; do stub brew false; done
|
||||
stub_make_install
|
||||
export PYTHON_BUILD_USE_HOMEBREW=1
|
||||
export PATH="$PORT_PREFIX/bin:$BREW_PREFIX/bin:$PATH"
|
||||
|
||||
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 sw_vers
|
||||
unstub brew
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${TMP}/install/include -I$BREW_PREFIX/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib -L$BREW_PREFIX/lib -Wl,-rpath,$BREW_PREFIX/lib" PKG_CONFIG_PATH=""
|
||||
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "Non-empty PYTHON_BUILD_USE_MACPORTS overrides PATH order selection" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
BREW_PREFIX="$TMP/homebrew-prefix"
|
||||
mkdir -p "$BREW_PREFIX/bin"
|
||||
PORT_PREFIX=$TMP
|
||||
|
||||
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
|
||||
for i in {1..3}; do stub port false; done
|
||||
stub_make_install
|
||||
export PYTHON_BUILD_USE_MACPORTS=1
|
||||
export PATH="$BREW_PREFIX/bin:$PORT_PREFIX/bin:$PATH"
|
||||
|
||||
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 sw_vers
|
||||
unstub port
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${TMP}/install/include -I$PORT_PREFIX/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib -L$PORT_PREFIX/lib -Wl,-rpath,$PORT_PREFIX/lib" PKG_CONFIG_PATH=""
|
||||
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "homebrew with uncommon prefix is added to search path" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
@ -222,7 +347,7 @@ OUT
|
||||
brew_libdir="$TMP/homebrew-yaml"
|
||||
mkdir -p "$brew_libdir"
|
||||
|
||||
for i in {1..10}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..11}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
|
||||
stub brew "--prefix libyaml : echo '$brew_libdir'"
|
||||
for i in {1..6}; do stub brew false; done
|
||||
@ -249,7 +374,7 @@ OUT
|
||||
|
||||
readline_libdir="$TMP/homebrew-readline"
|
||||
mkdir -p "$readline_libdir"
|
||||
for i in {1..8}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..9}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
|
||||
for i in {1..3}; do stub brew false; done
|
||||
stub brew "--prefix readline : echo '$readline_libdir'"
|
||||
@ -304,12 +429,100 @@ make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "yaml is linked from MacPorts" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
yaml_libdir="$TMP/port-yaml"
|
||||
mkdir -p "$yaml_libdir/opt/local"
|
||||
|
||||
for i in {1..5}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
|
||||
stub port "-q location libyaml : echo '$yaml_libdir'"
|
||||
for i in {1..3}; do stub port false; done
|
||||
stub_make_install
|
||||
|
||||
install_fixture definitions/needs-yaml
|
||||
assert_success
|
||||
|
||||
unstub uname
|
||||
unstub sw_vers
|
||||
unstub port
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I$yaml_libdir/opt/local/include -I${TMP}/install/include -I${TMP}/include" LDFLAGS="-L$yaml_libdir/opt/local/lib -L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib -L${TMP}/lib -Wl,-rpath,${TMP}/lib" PKG_CONFIG_PATH=""
|
||||
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "readline is linked from MacPorts" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
readline_libdir="$TMP/port-readline"
|
||||
mkdir -p "$readline_libdir/opt/local"
|
||||
|
||||
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 port "-q location readline : echo '$readline_libdir'"
|
||||
for i in {1..2}; do stub port false; done
|
||||
stub_make_install
|
||||
|
||||
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 sw_vers
|
||||
unstub port
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I$readline_libdir/opt/local/include -I${TMP}/install/include -I${TMP}/include" LDFLAGS="-L$readline_libdir/opt/local/lib -L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib -L${TMP}/lib -Wl,-rpath,${TMP}/lib" PKG_CONFIG_PATH=""
|
||||
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "ncurses is linked from MacPorts" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
ncurses_libdir="$TMP/port-ncurses"
|
||||
mkdir -p "$ncurses_libdir/opt/local"
|
||||
|
||||
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 port false
|
||||
stub port "-q location ncurses : echo '$ncurses_libdir'"
|
||||
stub port false
|
||||
stub_make_install
|
||||
|
||||
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 sw_vers
|
||||
unstub port
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I$ncurses_libdir/opt/local/include -I${TMP}/install/include -I${TMP}/include" LDFLAGS="-L$ncurses_libdir/opt/local/lib -L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib -L${TMP}/lib -Wl,-rpath,${TMP}/lib" PKG_CONFIG_PATH=""
|
||||
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "openssl is linked from Ports in FreeBSD if present" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..7}; do stub uname '-s : echo FreeBSD'; done
|
||||
for i in {1..5}; do stub uname '-s : echo FreeBSD'; done
|
||||
stub uname '-r : echo 11.0-RELEASE'
|
||||
for i in {1..3}; do stub uname '-s : echo FreeBSD'; done
|
||||
stub sysctl '-n hw.ncpu : echo 1'
|
||||
|
||||
stub pkg "info -e openssl : true"
|
||||
@ -341,9 +554,8 @@ OUT
|
||||
|
||||
for lib in readline sqlite3; do
|
||||
|
||||
for i in {1..7}; do stub uname '-s : echo FreeBSD'; done
|
||||
for i in {1..5}; do stub uname '-s : echo FreeBSD'; done
|
||||
stub uname '-r : echo 11.0-RELEASE'
|
||||
for i in {1..3}; do stub uname '-s : echo FreeBSD'; done
|
||||
stub sysctl '-n hw.ncpu : echo 1'
|
||||
|
||||
stub pkg false
|
||||
@ -376,7 +588,7 @@ OUT
|
||||
@test "homebrew is not touched if PYTHON_BUILD_SKIP_HOMEBREW is set" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..4}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..3}; 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
|
||||
@ -405,7 +617,7 @@ OUT
|
||||
BREW_PREFIX="$TMP/homebrew-prefix"
|
||||
mkdir -p "$BREW_PREFIX"
|
||||
|
||||
for i in {1..4}; do stub uname '-s : echo Linux'; done
|
||||
for i in {1..3}; do stub uname '-s : echo Linux'; done
|
||||
stub brew "--prefix : echo '$BREW_PREFIX'"
|
||||
for i in {1..5}; do stub brew false; done
|
||||
stub_make_install
|
||||
@ -435,7 +647,7 @@ OUT
|
||||
BREW_PREFIX="${BREW_PREFIX%/*}"
|
||||
BREW_PREFIX="${BREW_PREFIX%/*}"
|
||||
|
||||
for i in {1..4}; do stub uname '-s : echo Linux'; done
|
||||
for i in {1..3}; do stub uname '-s : echo Linux'; done
|
||||
stub brew "--prefix : echo '$BREW_PREFIX'"
|
||||
for i in {1..5}; do stub brew false; done
|
||||
stub_make_install
|
||||
@ -464,8 +676,8 @@ OUT
|
||||
BREW_PREFIX="$TMP/homebrew-prefix"
|
||||
mkdir -p "$BREW_PREFIX"
|
||||
|
||||
for i in {1..9}; do stub uname '-s : echo Linux'; done
|
||||
for i in {1..5}; do stub brew "--prefix : echo '$BREW_PREFIX'"; done
|
||||
for i in {1..4}; do stub uname '-s : echo Linux'; done
|
||||
stub brew "--prefix : echo '$BREW_PREFIX'"
|
||||
stub_make_install
|
||||
|
||||
run_inline_definition <<DEF
|
||||
@ -493,9 +705,8 @@ OUT
|
||||
mkdir -p "$readline_libdir/include/readline"
|
||||
touch "$readline_libdir/include/readline/rlconf.h"
|
||||
|
||||
for i in {1..8}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..9}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done
|
||||
|
||||
for i in {1..5}; do stub brew false; done
|
||||
stub_make_install
|
||||
|
||||
@ -617,11 +828,38 @@ make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "MacPorts is not touched if PYTHON_BUILD_SKIP_MACPORTS 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 port true; port
|
||||
stub_make_install
|
||||
export PYTHON_BUILD_SKIP_MACPORTS=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 port
|
||||
unstub make
|
||||
|
||||
assert_build_log <<OUT
|
||||
Python-3.6.2: CFLAGS="" CPPFLAGS="-I${TMP}/install/include" LDFLAGS="-L${TMP}/install/lib -Wl,-rpath,${TMP}/install/lib" PKG_CONFIG_PATH=""
|
||||
Python-3.6.2: --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib
|
||||
make -j 2
|
||||
make install
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "number of CPU cores defaults to 2" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..10}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done
|
||||
for i in {1..5}; do stub uname '-s : echo Darwin'; done
|
||||
stub sw_vers '-productVersion : echo 10.10'
|
||||
|
||||
stub sysctl false
|
||||
stub_make_install
|
||||
@ -647,8 +885,8 @@ OUT
|
||||
@test "number of CPU cores is detected on Mac" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..10}; do stub uname '-s : echo Darwin'; done
|
||||
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done
|
||||
for i in {1..5}; do stub uname '-s : echo Darwin'; done
|
||||
stub sw_vers '-productVersion : echo 10.10'
|
||||
|
||||
stub sysctl '-n hw.ncpu : echo 4'
|
||||
stub_make_install
|
||||
@ -675,9 +913,8 @@ OUT
|
||||
@test "number of CPU cores is detected on FreeBSD" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..7}; do stub uname '-s : echo FreeBSD'; done
|
||||
for i in {1..5}; do stub uname '-s : echo FreeBSD'; done
|
||||
stub uname '-r : echo 11.0-RELEASE'
|
||||
for i in {1..3}; do stub uname '-s : echo FreeBSD'; done
|
||||
for i in {1..3}; do stub pkg false; done
|
||||
|
||||
stub sysctl '-n hw.ncpu : echo 1'
|
||||
@ -704,7 +941,7 @@ OUT
|
||||
@test "setting PYTHON_MAKE_INSTALL_OPTS to a multi-word string" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..9}; do stub uname '-s : echo Linux'; done
|
||||
for i in {1..4}; do stub uname '-s : echo Linux'; done
|
||||
|
||||
stub_make_install
|
||||
|
||||
@ -728,7 +965,7 @@ OUT
|
||||
@test "--enable-shared is not added if --disable-shared is passed" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..9}; do stub uname '-s : echo Linux'; done
|
||||
for i in {1..4}; do stub uname '-s : echo Linux'; done
|
||||
|
||||
stub_make_install
|
||||
|
||||
@ -779,7 +1016,7 @@ OUT
|
||||
@test "configuring with dSYM has no effect in non-MacOS" {
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..10}; do stub uname '-s : echo Linux'; done
|
||||
for i in {1..5}; do stub uname '-s : echo Linux'; done
|
||||
stub_make_install
|
||||
|
||||
run_inline_definition <<DEF
|
||||
@ -812,9 +1049,8 @@ OUT
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
stub uname "-s : echo FreeBSD" "-r : echo 9.1"
|
||||
for i in {1..6}; do stub uname "-s : echo FreeBSD"; done
|
||||
for i in {1..4}; do stub uname "-s : echo FreeBSD"; done
|
||||
stub uname "-r : echo 9.1"
|
||||
for i in {1..3}; do stub uname "-s : echo FreeBSD"; done
|
||||
|
||||
MAKE=gmake stub_make_install
|
||||
|
||||
@ -829,9 +1065,8 @@ OUT
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE"
|
||||
for i in {1..6}; do stub uname "-s : echo FreeBSD"; done
|
||||
for i in {1..4}; do stub uname "-s : echo FreeBSD"; done
|
||||
stub uname "-r : echo 10.0-RELEASE"
|
||||
for i in {1..3}; do stub uname "-s : echo FreeBSD"; done
|
||||
|
||||
stub_make_install
|
||||
|
||||
@ -845,9 +1080,8 @@ OUT
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
stub uname "-s : echo FreeBSD" "-r : echo 11.0-RELEASE"
|
||||
for i in {1..6}; do stub uname "-s : echo FreeBSD"; done
|
||||
for i in {1..4}; do stub uname "-s : echo FreeBSD"; done
|
||||
stub uname "-r : echo 11.0-RELEASE"
|
||||
for i in {1..3}; do stub uname "-s : echo FreeBSD"; done
|
||||
|
||||
stub_make_install
|
||||
|
||||
@ -866,7 +1100,7 @@ apply -p1 -i /my/patch.diff
|
||||
exec ./configure "\$@"
|
||||
CONF
|
||||
|
||||
for i in {1..9}; do stub uname '-s : echo Linux'; done
|
||||
for i in {1..4}; do stub uname '-s : echo Linux'; done
|
||||
stub apply 'echo apply "$@" >> build.log'
|
||||
stub_make_install
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ NUM_DEFINITIONS="$(find "$BATS_TEST_DIRNAME"/../share/python-build -maxdepth 1 -
|
||||
echo true > "${TMP}/definitions/2.7.8-test"
|
||||
mkdir -p "${TMP}/other"
|
||||
echo false > "${TMP}/other/2.7.8-test"
|
||||
run bin/python-build "2.7.8-test" "${TMP}/install"
|
||||
run python-build "2.7.8-test" "${TMP}/install"
|
||||
assert_success ""
|
||||
}
|
||||
|
||||
|
||||
@ -325,7 +325,7 @@ EOS
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
for i in {1..4}; do stub brew false; done
|
||||
for i in {1..8}; do stub uname '-s : echo Linux'; done
|
||||
for i in {1..3}; do stub uname '-s : echo Linux'; done
|
||||
stub "$MAKE" \
|
||||
" : echo \"$MAKE \$@\" >> build.log" \
|
||||
" : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user