mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Merge branch 'ruby-build-v20130518'
This commit is contained in:
commit
1ce37e53c7
10 changed files with 212 additions and 3 deletions
|
@ -148,6 +148,14 @@ if [ -z "${PYTHON_BUILD_CACHE_PATH}" ] && [ -d "${PYENV_ROOT}/cache" ]; then
|
||||||
export PYTHON_BUILD_CACHE_PATH="${PYENV_ROOT}/cache"
|
export PYTHON_BUILD_CACHE_PATH="${PYENV_ROOT}/cache"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Default PYENV_VERSION to the globally-specified Python version. (The
|
||||||
|
# Python 3.4 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
|
||||||
|
|
||||||
|
|
||||||
# Execute `before_install` hooks.
|
# Execute `before_install` hooks.
|
||||||
for hook in "${before_hooks[@]}"; do eval "$hook"; done
|
for hook in "${before_hooks[@]}"; do eval "$hook"; done
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
PYTHON_BUILD_VERSION="20121023"
|
PYTHON_BUILD_VERSION="20130518"
|
||||||
|
|
||||||
set -E
|
set -E
|
||||||
exec 3<&2 # preserve original stderr at fd 3
|
exec 3<&2 # preserve original stderr at fd 3
|
||||||
|
@ -61,6 +61,10 @@ capitalize() {
|
||||||
printf "%s" "$1" | tr a-z A-Z
|
printf "%s" "$1" | tr a-z A-Z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sanitize() {
|
||||||
|
printf "%s" "$1" | sed "s/[^A-Za-z0-9.-]/_/g; s/__*/_/g"
|
||||||
|
}
|
||||||
|
|
||||||
build_failed() {
|
build_failed() {
|
||||||
{ echo
|
{ echo
|
||||||
echo "BUILD FAILED"
|
echo "BUILD FAILED"
|
||||||
|
@ -100,6 +104,10 @@ install_git() {
|
||||||
install_package_using "git" 2 "$@"
|
install_package_using "git" 2 "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_hg() {
|
||||||
|
install_package_using "hg" 2 "$@"
|
||||||
|
}
|
||||||
|
|
||||||
install_svn() {
|
install_svn() {
|
||||||
install_package_using "svn" 2 "$@"
|
install_package_using "svn" 2 "$@"
|
||||||
}
|
}
|
||||||
|
@ -330,6 +338,20 @@ fetch_git() {
|
||||||
echo "Cloning ${git_url}..." >&2
|
echo "Cloning ${git_url}..." >&2
|
||||||
|
|
||||||
if type git &>/dev/null; then
|
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
|
git clone --depth 1 --branch "$git_ref" "$git_url" "${package_name}" >&4 2>&1
|
||||||
else
|
else
|
||||||
echo "error: please install \`git\` and try again" >&2
|
echo "error: please install \`git\` and try again" >&2
|
||||||
|
@ -337,6 +359,38 @@ fetch_git() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fetch_hg() {
|
||||||
|
local package_name="$1"
|
||||||
|
local hg_url="$2"
|
||||||
|
local hg_ref="$3"
|
||||||
|
|
||||||
|
echo "Cloning ${hg_url}..." >&2
|
||||||
|
|
||||||
|
if type hg &>/dev/null; then
|
||||||
|
if [ -n "$PYTHON_BUILD_CACHE_PATH" ]; then
|
||||||
|
pushd "$PYTHON_BUILD_CACHE_PATH" >&4
|
||||||
|
local clone_name="$(sanitize "$hg_url")"
|
||||||
|
if [ -e "${clone_name}" ]; then
|
||||||
|
{ cd "${clone_name}"
|
||||||
|
hg pull --force "$hg_url"
|
||||||
|
} >&4 2>&1
|
||||||
|
else
|
||||||
|
{ hg clone --branch "$hg_ref" "$hg_url" "${clone_name}"
|
||||||
|
cd "${clone_name}"
|
||||||
|
hg update null
|
||||||
|
} >&4 2>&1
|
||||||
|
fi
|
||||||
|
hg_url="$PYTHON_BUILD_CACHE_PATH/${clone_name}"
|
||||||
|
popd >&4
|
||||||
|
fi
|
||||||
|
|
||||||
|
hg clone --branch "$hg_ref" "$hg_url" "${package_name}" >&4 2>&1
|
||||||
|
else
|
||||||
|
echo "error: please install \`hg\` and try again" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
fetch_svn() {
|
fetch_svn() {
|
||||||
local package_name="$1"
|
local package_name="$1"
|
||||||
local svn_url="$2"
|
local svn_url="$2"
|
||||||
|
@ -476,8 +530,13 @@ build_package_standard() {
|
||||||
local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
|
local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
|
||||||
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
|
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}"
|
( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then
|
||||||
"$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}"
|
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
|
"$MAKE" install
|
||||||
} >&4 2>&1
|
} >&4 2>&1
|
||||||
|
|
||||||
|
|
3
plugins/python-build/share/python-build/2.6-dev
Normal file
3
plugins/python-build/share/python-build/2.6-dev
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
install_hg "Python-2.6-dev" "https://bitbucket.org/mirror/cpython" "2.6" standard verify_py26
|
||||||
|
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
|
||||||
|
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python
|
3
plugins/python-build/share/python-build/2.7-dev
Normal file
3
plugins/python-build/share/python-build/2.7-dev
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
install_hg "Python-2.7-dev" "https://bitbucket.org/mirror/cpython" "2.7" standard verify_py27
|
||||||
|
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
|
||||||
|
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python
|
3
plugins/python-build/share/python-build/3.1-dev
Normal file
3
plugins/python-build/share/python-build/3.1-dev
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
install_hg "Python-3.1-dev" "https://bitbucket.org/mirror/cpython" "3.1" standard verify_py3
|
||||||
|
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
|
||||||
|
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python
|
3
plugins/python-build/share/python-build/3.2-dev
Normal file
3
plugins/python-build/share/python-build/3.2-dev
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
install_hg "Python-3.2-dev" "https://bitbucket.org/mirror/cpython" "3.2" standard verify_py3
|
||||||
|
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
|
||||||
|
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python
|
3
plugins/python-build/share/python-build/3.3-dev
Normal file
3
plugins/python-build/share/python-build/3.3-dev
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
install_hg "Python-3.3-dev" "https://bitbucket.org/mirror/cpython" "3.3" standard verify_py3
|
||||||
|
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
|
||||||
|
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python
|
3
plugins/python-build/share/python-build/3.4-dev
Normal file
3
plugins/python-build/share/python-build/3.4-dev
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
install_hg "Python-3.4-dev" "https://bitbucket.org/mirror/cpython" "default" standard verify_py3
|
||||||
|
install_package "distribute-0.6.40" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz#7a2dd4033999af22fe9591fa84f3e599" python
|
||||||
|
install_package "pip-1.3.1" "http://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#cbb27a191cebc58997c4da8513863153" python
|
|
@ -0,0 +1,47 @@
|
||||||
|
|
||||||
|
# HG changeset patch
|
||||||
|
# User Barry Warsaw <barry@python.org>
|
||||||
|
# Date 1302190091 14400
|
||||||
|
# Node ID bd0f73a9538e05f526feaf05821e68bdcff498fa
|
||||||
|
# Parent 2e4cdaffe493e879fb5367a4aa454491de451137
|
||||||
|
Backport for Python 2.7 of issue 11715 support for building Python on
|
||||||
|
multiarch Debian/Ubuntu.
|
||||||
|
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
--- setup.py.orig
|
||||||
|
+++ setup.py
|
||||||
|
@@ -345,10 +345,33 @@ class PyBuildExt(build_ext):
|
||||||
|
return platform
|
||||||
|
return sys.platform
|
||||||
|
|
||||||
|
+ def add_multiarch_paths(self):
|
||||||
|
+ # Debian/Ubuntu multiarch support.
|
||||||
|
+ # https://wiki.ubuntu.com/MultiarchSpec
|
||||||
|
+ if not find_executable('dpkg-architecture'):
|
||||||
|
+ return
|
||||||
|
+ tmpfile = os.path.join(self.build_temp, 'multiarch')
|
||||||
|
+ if not os.path.exists(self.build_temp):
|
||||||
|
+ os.makedirs(self.build_temp)
|
||||||
|
+ ret = os.system(
|
||||||
|
+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
|
||||||
|
+ tmpfile)
|
||||||
|
+ try:
|
||||||
|
+ if ret >> 8 == 0:
|
||||||
|
+ with open(tmpfile) as fp:
|
||||||
|
+ multiarch_path_component = fp.readline().strip()
|
||||||
|
+ add_dir_to_list(self.compiler.library_dirs,
|
||||||
|
+ '/usr/lib/' + multiarch_path_component)
|
||||||
|
+ add_dir_to_list(self.compiler.include_dirs,
|
||||||
|
+ '/usr/include/' + multiarch_path_component)
|
||||||
|
+ finally:
|
||||||
|
+ os.unlink(tmpfile)
|
||||||
|
+
|
||||||
|
def detect_modules(self):
|
||||||
|
# Ensure that /usr/local is always used
|
||||||
|
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
|
||||||
|
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
||||||
|
+ self.add_multiarch_paths()
|
||||||
|
|
||||||
|
# Add paths specified in the environment variables LDFLAGS and
|
||||||
|
# CPPFLAGS for header and library files.
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
diff -r -u ./Lib/ssl.py ../Python-2.6.8/Lib/ssl.py
|
||||||
|
--- ./Lib/ssl.py 2012-04-11 00:32:06.000000000 +0900
|
||||||
|
+++ ../Python-2.6.8/Lib/ssl.py 2013-05-08 19:44:49.000000000 +0900
|
||||||
|
@@ -61,7 +61,19 @@
|
||||||
|
|
||||||
|
from _ssl import SSLError
|
||||||
|
from _ssl import CERT_NONE, CERT_OPTIONAL, CERT_REQUIRED
|
||||||
|
-from _ssl import PROTOCOL_SSLv2, PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1
|
||||||
|
+from _ssl import PROTOCOL_SSLv3, PROTOCOL_SSLv23, PROTOCOL_TLSv1
|
||||||
|
+_PROTOCOL_NAMES = {
|
||||||
|
+ PROTOCOL_TLSv1: "TLSv1",
|
||||||
|
+ PROTOCOL_SSLv23: "SSLv23",
|
||||||
|
+ PROTOCOL_SSLv3: "SSLv3",
|
||||||
|
+}
|
||||||
|
+try:
|
||||||
|
+ from _ssl import PROTOCOL_SSLv2
|
||||||
|
+ _SSLv2_IF_EXISTS = PROTOCOL_SSLv2
|
||||||
|
+except ImportError:
|
||||||
|
+ _SSLv2_IF_EXISTS = None
|
||||||
|
+else:
|
||||||
|
+ _PROTOCOL_NAMES[PROTOCOL_SSLv2] = "SSLv2"
|
||||||
|
from _ssl import RAND_status, RAND_egd, RAND_add
|
||||||
|
from _ssl import \
|
||||||
|
SSL_ERROR_ZERO_RETURN, \
|
||||||
|
@@ -402,16 +414,7 @@
|
||||||
|
return DER_cert_to_PEM_cert(dercert)
|
||||||
|
|
||||||
|
def get_protocol_name(protocol_code):
|
||||||
|
- if protocol_code == PROTOCOL_TLSv1:
|
||||||
|
- return "TLSv1"
|
||||||
|
- elif protocol_code == PROTOCOL_SSLv23:
|
||||||
|
- return "SSLv23"
|
||||||
|
- elif protocol_code == PROTOCOL_SSLv2:
|
||||||
|
- return "SSLv2"
|
||||||
|
- elif protocol_code == PROTOCOL_SSLv3:
|
||||||
|
- return "SSLv3"
|
||||||
|
- else:
|
||||||
|
- return "<unknown>"
|
||||||
|
+ return _PROTOCOL_NAMES.get(protocol_code, '<unknown>')
|
||||||
|
|
||||||
|
|
||||||
|
# a replacement for the old socket.ssl function
|
||||||
|
diff -r -u ./Modules/_ssl.c ../Python-2.6.8/Modules/_ssl.c
|
||||||
|
--- ./Modules/_ssl.c 2012-04-11 00:32:09.000000000 +0900
|
||||||
|
+++ ../Python-2.6.8/Modules/_ssl.c 2013-05-08 17:34:38.000000000 +0900
|
||||||
|
@@ -62,7 +62,9 @@
|
||||||
|
};
|
||||||
|
|
||||||
|
enum py_ssl_version {
|
||||||
|
+#ifndef OPENSSL_NO_SSL2
|
||||||
|
PY_SSL_VERSION_SSL2,
|
||||||
|
+#endif
|
||||||
|
PY_SSL_VERSION_SSL3,
|
||||||
|
PY_SSL_VERSION_SSL23,
|
||||||
|
PY_SSL_VERSION_TLS1
|
||||||
|
@@ -302,8 +304,10 @@
|
||||||
|
self->ctx = SSL_CTX_new(TLSv1_method()); /* Set up context */
|
||||||
|
else if (proto_version == PY_SSL_VERSION_SSL3)
|
||||||
|
self->ctx = SSL_CTX_new(SSLv3_method()); /* Set up context */
|
||||||
|
+#ifndef OPENSSL_NO_SSL2
|
||||||
|
else if (proto_version == PY_SSL_VERSION_SSL2)
|
||||||
|
self->ctx = SSL_CTX_new(SSLv2_method()); /* Set up context */
|
||||||
|
+#endif
|
||||||
|
else if (proto_version == PY_SSL_VERSION_SSL23)
|
||||||
|
self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */
|
||||||
|
PySSL_END_ALLOW_THREADS
|
||||||
|
@@ -1688,8 +1692,10 @@
|
||||||
|
PY_SSL_CERT_REQUIRED);
|
||||||
|
|
||||||
|
/* protocol versions */
|
||||||
|
+#ifndef OPENSSL_NO_SSL2
|
||||||
|
PyModule_AddIntConstant(m, "PROTOCOL_SSLv2",
|
||||||
|
PY_SSL_VERSION_SSL2);
|
||||||
|
+#endif
|
||||||
|
PyModule_AddIntConstant(m, "PROTOCOL_SSLv3",
|
||||||
|
PY_SSL_VERSION_SSL3);
|
||||||
|
PyModule_AddIntConstant(m, "PROTOCOL_SSLv23",
|
Loading…
Reference in a new issue