From b3deef5e80bc45c3d2b48452037a4fe55a99f987 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Tue, 21 May 2013 11:43:01 +0900 Subject: [PATCH] update base version of ruby-build (v20130518) --- plugins/python-build/bin/pyenv-install | 3 +++ plugins/python-build/bin/python-build | 29 +++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/plugins/python-build/bin/pyenv-install b/plugins/python-build/bin/pyenv-install index 68e5368b..d65b208a 100755 --- a/plugins/python-build/bin/pyenv-install +++ b/plugins/python-build/bin/pyenv-install @@ -148,6 +148,9 @@ if [ -z "${PYTHON_BUILD_CACHE_PATH}" ] && [ -d "${PYENV_ROOT}/cache" ]; then export PYTHON_BUILD_CACHE_PATH="${PYENV_ROOT}/cache" fi +# Default PYENV_VERSION to the globally-specified Python version. +export PYENV_VERSION="$(pyenv global 2>/dev/null || true)" + # Execute `before_install` hooks. for hook in "${before_hooks[@]}"; do eval "$hook"; done diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index c7f17595..3bc6be3c 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1,6 +1,6 @@ #!/usr/bin/env bash -PYTHON_BUILD_VERSION="20121023" +PYTHON_BUILD_VERSION="20130518" set -E exec 3<&2 # preserve original stderr at fd 3 @@ -61,6 +61,10 @@ capitalize() { printf "%s" "$1" | tr a-z A-Z } +sanitize() { + printf "%s" "$1" | sed "s/[^A-Za-z0-9.-]/_/g; s/__*/_/g" +} + build_failed() { { echo echo "BUILD FAILED" @@ -330,6 +334,20 @@ fetch_git() { echo "Cloning ${git_url}..." >&2 if type git &>/dev/null; then + if [ -n "$PYTHON_BUILD_CACHE_PATH" ]; then + pushd "$PYTHON_BUILD_CACHE_PATH" >&4 + local clone_name="$(sanitize "$git_url")" + if [ -e "${clone_name}" ]; then + { cd "${clone_name}" + git fetch --force "$git_url" "+${git_ref}:${git_ref}" + } >&4 2>&1 + else + git clone --bare --branch "$git_ref" "$git_url" "${clone_name}" >&4 2>&1 + fi + git_url="$PYTHON_BUILD_CACHE_PATH/${clone_name}" + popd >&4 + fi + git clone --depth 1 --branch "$git_ref" "$git_url" "${package_name}" >&4 2>&1 else echo "error: please install \`git\` and try again" >&2 @@ -476,8 +494,13 @@ build_package_standard() { local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]" local PACKAGE_CFLAGS="${package_var_name}_CFLAGS" - { CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}" ${!PACKAGE_CONFIGURE:-./configure} --prefix="${!PACKAGE_PREFIX_PATH:-$PREFIX_PATH}" $CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" - "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}" + ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then + export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}" + fi + ${!PACKAGE_CONFIGURE:-./configure} --prefix="${!PACKAGE_PREFIX_PATH:-$PREFIX_PATH}" $CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" + ) >&4 2>&1 + + { "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}" "$MAKE" install } >&4 2>&1