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

This commit is contained in:
Yamashita, Yuu 2015-12-20 12:29:30 +00:00
parent 6bcb1d6211
commit 3031cb9750
2 changed files with 30 additions and 21 deletions

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}"

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" {