From 58e24a64a21ab93c126b57341b81cc5ff5b5dba4 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Sat, 11 Oct 2014 01:40:17 +0900 Subject: [PATCH] Set PYENV_VERSION on building pypy from source --- plugins/python-build/bin/pyenv-install | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/python-build/bin/pyenv-install b/plugins/python-build/bin/pyenv-install index 677f5c8b..7d585aff 100755 --- a/plugins/python-build/bin/pyenv-install +++ b/plugins/python-build/bin/pyenv-install @@ -182,6 +182,26 @@ if [[ "${VERSION_NAME}" == [23]"."* ]]; then done 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 + 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 + exit 1 + fi + fi + fi +fi # Execute `before_install` hooks. for hook in "${before_hooks[@]}"; do eval "$hook"; done