From b943e0abffae22889fd778fc52603488e5dbb83f Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Wed, 24 Jul 2013 23:23:35 +0900 Subject: [PATCH 1/2] Import changes from ruby-build v20130628 --- plugins/python-build/bin/pyenv-install | 6 +- plugins/python-build/bin/python-build | 174 +++++++++++++++---------- 2 files changed, 107 insertions(+), 73 deletions(-) diff --git a/plugins/python-build/bin/pyenv-install b/plugins/python-build/bin/pyenv-install index b8352f6e..718a02f4 100755 --- a/plugins/python-build/bin/pyenv-install +++ b/plugins/python-build/bin/pyenv-install @@ -149,12 +149,10 @@ if [ -z "${PYTHON_BUILD_CACHE_PATH}" ] && [ -d "${PYENV_ROOT}/cache" ]; then fi # Default PYENV_VERSION to the globally-specified Python version. (The -# Python 3.4 installer requires an existing Python installation to run. An +# CPython installer requires an existing Python installation to run. An # unsatisfied local .python-version file can cause the installer to # fail.) -#if [ -z "${PYENV_VERSION}" ]; then -# export PYENV_VERSION="$(pyenv global 2>/dev/null || true)" -#fi +#export PYENV_VERSION="$(pyenv global 2>/dev/null || true)" # Execute `before_install` hooks. diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 5f5ad0e3..d262fd80 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="20130518" +PYTHON_BUILD_VERSION="20130628" set -E exec 3<&2 # preserve original stderr at fd 3 @@ -203,11 +203,11 @@ verify_checksum() { [ -e "$filename" ] || return 0 # If there's no expected checksum, return success - local expected_checksum="$2" + local expected_checksum=`echo "$2" | tr [A-Z] [a-z]` [ -n "$expected_checksum" ] || return 0 # If the computed checksum is empty, return failure - local computed_checksum="$(compute_md5 < "$filename")" + local computed_checksum=`echo "$(compute_md5 < "$filename")" | tr [A-Z] [a-z]` [ -n "$computed_checksum" ] || return 1 if [ "$expected_checksum" != "$computed_checksum" ]; then @@ -520,7 +520,7 @@ build_package_standard() { MAKE_OPTS="-j 2" fi - # Support PYTHON_CONFIGURE_OPTS, etc. + # Support YAML_CONFIGURE_OPTS, PYTHON_CONFIGURE_OPTS, etc. local package_var_name="$(capitalize "${package_name%%-*}")" local PACKAGE_CONFIGURE="${package_var_name}_CONFIGURE" local PACKAGE_PREFIX_PATH="${package_var_name}_PREFIX_PATH" @@ -645,7 +645,7 @@ require_cc() { local esc=$'\033' { echo echo "${esc}[1mERROR${esc}[0m: This package must be compiled with $ccname, but python-build couldn't" - echo "find a suitable \`cc\` executable on your system. Please install $ccname" + echo "find a suitable \`$ccname\` executable on your system. Please install $ccname" echo "and try again." echo } >&3 @@ -723,10 +723,81 @@ verify_cc() { echo "$cc" } +require_java() { + local java="$(locate_java || true)" + + if [ -z "$java" ]; then + local esc=$'\033' + { echo + echo "${esc}[1mERROR${esc}[0m: This package must be installed with java, but python-build couldn't" + echo "find a suitable \`java\` executable on your system. Please install Java" + echo "and try again." + echo + } >&3 + return 1 + fi + + export JAVA="$java" +} + +locate_java() { + local java javas + IFS=: javas=($(javas_in_path)) + + verify_java "$JAVA" || + verify_java "$(command -v java || true)" || { + for java in "${javas[@]}"; do + verify_java "$java" && break || true + done + } + + return 1 +} + +javas_in_path() { + local java path paths + local javas=() + IFS=: paths=($PATH) + + shopt -s nullglob + for path in "${paths[@]}"; do + local java="$path"/java + if [ -x "$java" ]; then + javas["${#javas[@]}"]="$java" + fi + done + shopt -u nullglob + + printf :%s "${javas[@]}" +} + +verify_java() { + local java="$1" + if [ -z "$java" ]; then + return 1 + fi + + if [ ! -x "$java" ]; then + return 1 + fi + + echo "$java" +} + has_broken_mac_openssl() { [ "$(uname -s)" = "Darwin" ] && - [ "$(openssl version 2>/dev/null || true)" = "OpenSSL 0.9.8r 8 Feb 2011" ] #&& -# [[ "$PYTHON_CONFIGURE_OPTS" != *--with-openssl-dir=* ]] # The "--with-*-dir=" style arguments are only effective for mkmf.rb + [[ "$(openssl version 2>/dev/null || true)" = "OpenSSL 0.9.8"?* ]] && + ! use_homebrew_openssl +} + +use_homebrew_openssl() { + local ssldir="$(brew --prefix openssl 2>/dev/null || true)" + if [ -d "$ssldir" ]; then + CPPFLAGS="-I$ssldir/include $CPPFLAGS" + LDFLAGS="-L$ssldir/lib $LDFLAGS" + else + return 1 + fi } build_package_mac_openssl() { @@ -759,18 +830,34 @@ build_package_mac_openssl() { } has_broken_mac_readline() { + [ "$(uname -s)" = "Darwin" ] && + _has_broken_mac_readline && + ! use_homebrew_readline +} + +_has_broken_mac_readline() { # MacOSX 10.4 has a broken readline. # https://github.com/yyuu/pyenv/issues/23 local retval=1 local conftest="$BUILD_PATH/has_broken_mac_readline.h" if [ "$(uname -s)" = "Darwin" ]; then echo "#include " > "$conftest" - "${CPP:-cpp}" $CFLAGS $CPPFLAGS $LDFLAGS "$conftest" 1>/dev/null 2>&1 || retval=0 + "${CPP:-cpp}" $CPPFLAGS "$conftest" 1>/dev/null 2>&1 || retval=0 rm -f "$conftest" fi return "$retval" } +use_homebrew_readline() { + local rldir="$(brew --prefix readline 2>/dev/null || true)" + if [ -d "$rldir" ]; then + CPPFLAGS="-I$rldir/include $CPPFLAGS" + LDFLAGS="-L$rldir/lib $LDFLAGS" + else + return 1 + fi +} + has_broken_mac_llvm_gcc() { [ "$(uname -s)" = "Darwin" ] && [[ "$(gcc --version 2>/dev/null || true)" == *"llvm-gcc-4.2"* ]] @@ -874,67 +961,6 @@ except ImportError: ' >&4 2>&1 } -require_java() { - local java="$(locate_java || true)" - - if [ -z "$java" ]; then - local esc=$'\033' - { echo - echo "${esc}[1mERROR${esc}[0m: This package must be installed with java, but python-build couldn't" - echo "find a suitable \`java\` executable on your system. Please install Java" - echo "and try again." - echo - } >&3 - return 1 - fi - - export JAVA="$java" -} - -locate_java() { - local java javas - IFS=: javas=($(javas_in_path)) - - verify_java "$JAVA" || - verify_java "$(command -v java || true)" || { - for java in "${javas[@]}"; do - verify_java "$java" && break || true - done - } - - return 1 -} - -javas_in_path() { - local java path paths - local javas=() - IFS=: paths=($PATH) - - shopt -s nullglob - for path in "${paths[@]}"; do - local java="$path"/java - if [ -x "$java" ]; then - javas["${#javas[@]}"]="$java" - fi - done - shopt -u nullglob - - printf :%s "${javas[@]}" -} - -verify_java() { - local java="$1" - if [ -z "$java" ]; then - return 1 - fi - - if [ ! -x "$java" ]; then - return 1 - fi - - echo "$java" -} - version() { echo "python-build ${PYTHON_BUILD_VERSION}" } @@ -1023,6 +1049,16 @@ else TMP="${TMPDIR%/}" fi +# Work around warnings building Ruby 2.0 on Clang 2.x: +# pass -Wno-error=shorten-64-to-32 if the compiler accepts it. +# +# When we set CFLAGS, Ruby won't apply its default flags, though. Since clang +# builds 1.9.x and 2.x only, where -O3 is default, we can safely set that flag. +# Ensure it's the first flag since later flags take precedence. +#if "${CC:-cc}" -x c /dev/null -E -Wno-error=shorten-64-to-32 &>/dev/null; then +# PYTHON_CFLAGS="-O3 -Wno-error=shorten-64-to-32 $PYTHON_CFLAGS" +#fi + if [ -z "$MAKE" ]; then export MAKE="make" fi From b1851f2aff0608123a94ca1cc776cd099a4912d0 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Wed, 24 Jul 2013 23:37:51 +0900 Subject: [PATCH 2/2] Update README --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce5449e0..fe8a8457 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ ## Version History +#### 0.4.0-2013MMDD + +* pyenv: Fix minor issue of variable scope in `pyenv versions` +* python-build: Update base version to ruby-build v20130628 +* python-build: Use brew managed OpenSSL and GNU Readline if they are available +* python-build: Fix build of CPython 3.3+ on OS X (#29) +* python-build: Fix build of native modules of CPython 2.5 on OS X (#33) +* python-build: Fix build of CPython 2.6+ on openSUSE (#36) +* python-build: Add ancient versions; 2.4.2 and 2.4.6. The build might be broken. (#37) +* python-build: Update default pip version (1.3.1 -> 1.4) +* python-build: Update default setuptools version (0.7.2 -> 0.9.7) + #### 0.4.0-20130613 * pyenv: Changed versioning schema. There are two parts; the former is the base rbenv version, and the latter is the date of release.