Browse Source

Add workaround for test failure on Arch Linux (#480)

pull/511/head
Yamashita, Yuu 8 years ago
parent
commit
3031cb9750
2 changed files with 30 additions and 21 deletions
  1. +27
    -18
      plugins/python-build/bin/python-build
  2. +3
    -3
      test/which.bats

+ 27
- 18
plugins/python-build/bin/python-build View File

@ -1231,8 +1231,31 @@ require_distro() {
return 1
}
configured_with_package_dir() {
local package_var_name="$(capitalize "$1")"
shift 1
local PACKAGE_CONFIGURE_OPTS="${package_var_name}_CONFIGURE_OPTS"
local PACKAGE_CONFIGURE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
local arg flag
for arg in ${CONFIGURE_OPTS} ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}"; do
if [[ "$arg" == "CPPFLAGS="* ]]; then
for flag in ${CPPFLAGS} ${arg##CPPFLAGS=}; do
if [[ "$flag" == "-I"* ]]; then
local header
for header in "$@"; do
if [ -e "${flag##-I}/${header#/}" ]; then
return 0
fi
done
fi
done
fi
done
return 1
}
needs_yaml() {
[[ "$RUBY_CONFIGURE_OPTS" != *--with-libyaml-dir=* ]] &&
! configured_with_package_dir "python" "yaml.h" &&
! use_homebrew_yaml
}
@ -1246,30 +1269,16 @@ use_homebrew_yaml() {
fi
}
configured_with_readline_dir() {
has_broken_mac_readline() {
# Mac OS X 10.4 has broken readline.
# https://github.com/yyuu/pyenv/issues/23
local arg flag
for arg in ${CONFIGURE_OPTS} ${PYTHON_CONFIGURE_OPTS} "${PYTHON_CONFIGURE_OPTS_ARRAY[@]}"; do
if [[ "$arg" == "CPPFLAGS="* ]]; then
for flag in ${CPPFLAGS} ${arg##CPPFLAGS=}; do
if [[ "$flag" == "-I"* ]] && [ -e "${flag##-I}/readline/rlconf.h" ]; then
return 0
fi
done
fi
done
return 1
}
has_broken_mac_readline() {
[ "$(uname -s)" = "Darwin" ] &&
! configured_with_readline_dir &&
! configured_with_package_dir "python" "readline/rlconf.h" &&
! use_homebrew_readline
}
use_homebrew_readline() {
if ! configured_with_readline_dir; then
if ! configured_with_package_dir "python" "readline/rlconf.h"; then
local libdir="$(brew --prefix readline 2>/dev/null || true)"
if [ -d "$libdir" ]; then
export CPPFLAGS="-I$libdir/include ${CPPFLAGS}"

+ 3
- 3
test/which.bats View File

@ -91,9 +91,9 @@ OUT
}
@test "no executable found for system version" {
export PATH="$(path_without "rake")"
PYENV_VERSION=system run pyenv-which rake
assert_failure "pyenv: rake: command not found"
export PATH="$(path_without "py.test")"
PYENV_VERSION=system run pyenv-which py.test
assert_failure "pyenv: py.test: command not found"
}
@test "executable found in other versions" {

Loading…
Cancel
Save