Check existence of curses module before start building PyPy (#244)

This commit is contained in:
Yamashita Yuu 2014-10-13 02:29:55 +09:00
parent 6e02ad2fe4
commit fc41c87395

View file

@ -184,22 +184,23 @@ fi
# PyPy requires existing Python 2.x to build
if [[ "${VERSION_NAME}" == "pypy-"*"-src" ]]; then
PYENV_VERSION="$(pyenv-whence "python2.7" 2>/dev/null | tail -n 1 || true)"
if [ -n "${PYENV_VERSION}" ]; then
export PYENV_VERSION
if [ -z "$PYENV_RPYTHON_VERSION" ]; then
for version in $(pyenv-versions --bare | sort -r); do
if [[ "$version" == 2.[567] ]] || [[ "$version" == 2.[567].* ]]; then
PYENV_RPYTHON_VERSION="$version"
fi
done
fi
if [ -n "$PYENV_RPYTHON_VERSION" ]; then
if PYENV_VERSION="$PYENV_RPYTHON_VERSION" pyenv-exec python -c 'import curses' 1>/dev/null 2>&1; then
export PYENV_VERSION="$PYENV_RPYTHON_VERSION"
else
PYENV_VERSION="$(pyenv-whence "python2.6" 2>/dev/null | tail -n 1 || true)"
if [ -n "${PYENV_VERSION}" ]; then
export PYENV_VERSION
else
PYENV_VERSION="$(pyenv-whence "python2.5" 2>/dev/null | tail -n 1 || true)"
if [ -n "${PYENV_VERSION}" ]; then
export PYENV_VERSION
else
echo "pyenv-install: $VERSION_NAME requires CPython 2.[567] to build" >^2
echo "pyenv-install: $VERSION_NAME: PyPy requires \`curses' in $PYENV_RPYTHON_VERSION to build from source." >&2
exit 1
fi
fi
else
echo "pyenv-install: $VERSION_NAME: PyPy requires Python 2.5, 2.6 or 2.7 to build from source." >&2
exit 1
fi
fi