diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index cd333a4a..314158f8 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -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 diff --git a/plugins/python-build/test/build.bats b/plugins/python-build/test/build.bats index bcf656c2..e324c02d 100644 --- a/plugins/python-build/test/build.bats +++ b/plugins/python-build/test/build.bats @@ -62,7 +62,7 @@ assert_build_log() { cached_tarball "yaml-0.1.6" cached_tarball "Python-3.6.2" - for i in {1..4}; do stub uname '-s : echo Linux'; done + for i in {1..9}; do stub uname '-s : echo Linux'; done stub brew false stub_make_install stub_make_install @@ -89,7 +89,7 @@ OUT cached_tarball "yaml-0.1.6" cached_tarball "Python-3.6.2" - for i in {1..4}; do stub uname '-s : echo Linux'; done + for i in {1..9}; do stub uname '-s : echo Linux'; done stub brew false stub_make_install stub_make_install @@ -119,15 +119,12 @@ OUT cached_tarball "yaml-0.1.6" cached_tarball "Python-3.6.2" - stub uname '-s : echo Linux' '-s : echo Linux' + for i in {1..9}; do stub uname '-s : echo Linux'; done stub brew false stub_make_install stub_make_install stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log' - # pyenv/pyenv#1026 - stub uname false false - TMPDIR="$TMP" install_fixture --patch definitions/needs-yaml <<<"diff --git a/script.py" assert_success @@ -154,7 +151,7 @@ OUT BREW_PREFIX="$TMP/homebrew-prefix" mkdir -p "$BREW_PREFIX" - for i in {1..4}; 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 stub brew "--prefix : echo '$BREW_PREFIX'" false stub_make_install @@ -164,8 +161,8 @@ install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2. DEF assert_success - unstub sw_vers unstub uname + unstub sw_vers unstub make assert_build_log <>"$tcl_tk_libdir/lib/tclConfig.sh" - stub uname false + for i in {1..10}; do stub uname '-s : echo Darwin'; done + for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done + stub brew false for i in {1..2}; do stub brew "--prefix tcl-tk : echo '$tcl_tk_libdir'"; done for i in {1..2}; do stub brew false; done + stub_make_install run_inline_definition <> build.log' stub_make_install - # yyuu/pyenv#257 - stub uname '-s : echo Linux' - stub uname '-s : echo Linux' - stub uname '-s : echo Linux' - export PYTHON_CONFIGURE="${TMP}/custom-configure" run_inline_definition <> build.log" \ " : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'" @@ -332,7 +332,6 @@ OUT unstub make unstub uname - unstub brew } @test "default MACOSX_DEPLOYMENT_TARGET" {