Import changes from ruby-build v20131225.1

This commit is contained in:
Yamashita Yuu 2013-12-27 18:44:54 +09:00
parent b70dcb9f2d
commit 1f76effbfb
2 changed files with 49 additions and 18 deletions

View file

@ -1,17 +1,21 @@
#!/usr/bin/env bash
#
# Summary: Install a Python version using the python-build plugin
# Summary: Install a Python version using python-build
#
# Usage: pyenv install [-f|--force] [-g|--debug] [-k|--keep] [-v|--verbose] <version>
# pyenv install [-f|--force] [-g|--debug] [-k|--keep] [-v|--verbose] <definition-file>
# Usage: pyenv install [-f] [-kvp] <version>
# pyenv install [-f] [-kvp] <definition-file>
# pyenv install -l|--list
#
# -l/--list List all available versions
# -f/--force Install even if the version appears to be installed already
#
# python-build options:
#
# -k/--keep Keep source tree in $PYENV_BUILD_ROOT after installation
# (defaults to $PYENV_ROOT/sources)
# -g/--debug Build a debug version
# -v/--verbose Verbose mode: print compilation status to stdout
# -p/--patch Apply a patch from stdin before building
# -g/--debug Build a debug version
#
# For detailed information on installing Python versions with
# python-build, including a list of environment variables for adjusting
@ -50,6 +54,7 @@ indent() {
unset FORCE
unset KEEP
unset VERBOSE
unset HAS_PATCH
unset DEBUG
parse_options "$@"
@ -72,6 +77,9 @@ for option in "${OPTIONS[@]}"; do
"v" | "verbose" )
VERBOSE="-v"
;;
"p" | "patch" )
HAS_PATCH="-p"
;;
"g" | "debug" )
DEBUG="-g"
;;
@ -167,7 +175,7 @@ trap cleanup SIGINT
# Invoke `python-build` and record the exit status in $STATUS.
STATUS=0
python-build $KEEP $VERBOSE $DEBUG "$DEFINITION" "$PREFIX" || STATUS="$?"
python-build $KEEP $VERBOSE $HAS_PATCH $DEBUG "$DEFINITION" "$PREFIX" || STATUS="$?"
# Display a more helpful message if the definition wasn't found.
if [ "$STATUS" == "2" ]; then

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
PYTHON_BUILD_VERSION="20131211"
PYTHON_BUILD_VERSION="20131225.1"
set -E
exec 3<&2 # preserve original stderr at fd 3
@ -307,16 +307,14 @@ fetch_tarball() {
local tar_args="xzvf"
local package_filename="${package_name}.tar.gz"
local package_suffix extract_option
case "${package_url}" in
*".tgz" )
package_filename="${package_name}.tgz"
;;
*".tar.bz2" )
package_filename="${package_name}.tar.bz2"
if [ "$package_url" != "${package_url%tgz}" ]; then
package_filename="${package_filename%tar.gz}tgz"
fi
if [ "$package_url" != "${package_url%bz2}" ]; then
package_filename="${package_filename%.gz}.bz2"
tar_args="${tar_args/z/j}"
;;
esac
fi
if ! symlink_tarball_from_cache "$package_filename" "$checksum"; then
echo "Downloading ${package_filename}..." >&2
@ -527,6 +525,8 @@ build_package() {
echo "Installing ${package_name}..." >&2
[ -n "$HAS_PATCH" ] && apply_python_patch "$package_name"
for command in $commands; do
"build_package_${command}" "$package_name"
done
@ -677,6 +677,7 @@ build_package_jruby() {
ln -fs jruby ruby
install_jruby_launcher
remove_windows_files
fix_jruby_shebangs
}
install_jruby_launcher() {
@ -685,6 +686,15 @@ install_jruby_launcher() {
} >&4 2>&1
}
fix_jruby_shebangs() {
for file in "${PREFIX_PATH}/bin"/*; do
if [ "$(head -c 20 "$file")" = "#!/usr/bin/env jruby" ]; then
sed -i.bak -E "1s:.+:#\!${PREFIX_PATH}/bin/jruby:" "$file"
rm "$file".bak
fi
done
}
remove_windows_files() {
cd "$PREFIX_PATH"
rm -f bin/*.exe bin/*.dll bin/*.bat bin/jruby.sh
@ -1078,6 +1088,14 @@ isolated_gem_install() {
gem install "$@"
}
apply_python_patch() {
case "$1" in
Python-* | jython-* | pypy-* )
patch -p0 -i "${2:--}"
;;
esac
}
has_broken_mac_llvm_gcc() {
[ "$(uname -s)" = "Darwin" ] &&
[[ "$(gcc --version 2>/dev/null || true)" == *"llvm-gcc-4.2"* ]]
@ -1208,7 +1226,7 @@ version() {
usage() {
{ version
echo "usage: python-build [-g|--debug] [-k|--keep] [-v|--verbose] definition prefix"
echo "usage: python-build [-k|--keep] [-v|--verbose] [-p|--patch] [-g|--debug] definition prefix"
echo " python-build --definitions"
} >&2
@ -1228,8 +1246,9 @@ list_definitions() {
unset VERBOSE
unset KEEP_BUILD_PATH
PYTHON_BUILD_ROOT="$(abs_dirname "$0")/.."
unset HAS_PATCH
unset DEBUG
PYTHON_BUILD_ROOT="$(abs_dirname "$0")/.."
parse_options "$@"
@ -1239,8 +1258,9 @@ for option in "${OPTIONS[@]}"; do
usage without_exiting
{ echo
echo " -k/--keep Do not remove source tree after installation"
echo " -g/--debug Build a debug version"
echo " -v/--verbose Verbose mode: print compilation status to stdout"
echo " -p/--patch Apply a patch from stdin before building"
echo " -g/--debug Build a debug version"
echo " --definitions List all built-in definitions"
echo
} >&2
@ -1256,6 +1276,9 @@ for option in "${OPTIONS[@]}"; do
"v" | "verbose" )
VERBOSE=true
;;
"p" | "patch" )
HAS_PATCH=true
;;
"g" | "debug" )
DEBUG=true
;;