Allow overriding HTTP client type based on environment variable PYTHON_BUILD_HTTP_CLIENT
(#1126)
This commit is contained in:
parent
63c4b7f45c
commit
fc90785f75
@ -328,21 +328,22 @@ http() {
|
|||||||
local file="$3"
|
local file="$3"
|
||||||
[ -n "$url" ] || return 1
|
[ -n "$url" ] || return 1
|
||||||
|
|
||||||
|
local http_client
|
||||||
|
if [ -n "${PYTHON_BUILD_HTTP_CLIENT}" ]; then
|
||||||
|
http_client="http_${method}_${PYTHON_BUILD_HTTP_CLIENT}"
|
||||||
|
else
|
||||||
if type aria2c &>/dev/null; then
|
if type aria2c &>/dev/null; then
|
||||||
"http_${method}_aria2c" "$url" "$file"
|
http_client="http_${method}_aria2c"
|
||||||
elif type curl &>/dev/null; then
|
elif type curl &>/dev/null; then
|
||||||
"http_${method}_curl" "$url" "$file"
|
http_client="http_${method}_curl"
|
||||||
elif type wget &>/dev/null; then
|
elif type wget &>/dev/null; then
|
||||||
# SSL Certificate error with older wget that does not support Server Name Indication (#60)
|
http_client="http_${method}_wget"
|
||||||
if [[ "$(wget --version 2>/dev/null || true)" = "GNU Wget 1.1"[0-3]* ]]; then
|
|
||||||
echo "python-build: wget (< 1.14) doesn't support Server Name Indication. Please install curl (>= 7.18.1) and try again" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
"http_${method}_wget" "$url" "$file"
|
|
||||||
else
|
else
|
||||||
echo "error: please install \`aria2c\`, \`curl\` or \`wget\` and try again" >&2
|
echo "error: please install \`aria2c\`, \`curl\` or \`wget\` and try again" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
"${http_client}" "$url" "$file"
|
||||||
}
|
}
|
||||||
|
|
||||||
http_head_aria2c() {
|
http_head_aria2c() {
|
||||||
@ -2031,6 +2032,14 @@ ARIA2_OPTS="${PYTHON_BUILD_ARIA2_OPTS} ${IPV4+--disable-ipv6=true} ${IPV6+--disa
|
|||||||
CURL_OPTS="${PYTHON_BUILD_CURL_OPTS} ${IPV4+--ipv4} ${IPV6+--ipv6}"
|
CURL_OPTS="${PYTHON_BUILD_CURL_OPTS} ${IPV4+--ipv4} ${IPV6+--ipv6}"
|
||||||
WGET_OPTS="${PYTHON_BUILD_WGET_OPTS} ${IPV4+--inet4-only} ${IPV6+--inet6-only}"
|
WGET_OPTS="${PYTHON_BUILD_WGET_OPTS} ${IPV4+--inet4-only} ${IPV6+--inet6-only}"
|
||||||
|
|
||||||
|
if [ -z "${PYTHON_BUILD_HTTP_CLIENT}" ] && ! type aria2c &>/dev/null && ! type curl &>/dev/null; then
|
||||||
|
# SSL Certificate error with older wget that does not support Server Name Indication (#60)
|
||||||
|
if [[ "$(wget --version 2>/dev/null || true)" = "GNU Wget 1.1"[0-3]* ]]; then
|
||||||
|
echo "python-build: wget (< 1.14) doesn't support Server Name Indication. Please install curl (>= 7.18.1) and try again" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Add an option to build a debug version of Python (#11)
|
# Add an option to build a debug version of Python (#11)
|
||||||
if [ -n "$DEBUG" ]; then
|
if [ -n "$DEBUG" ]; then
|
||||||
package_option python configure --with-pydebug
|
package_option python configure --with-pydebug
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
unset PYENV_VERSION
|
unset PYENV_VERSION
|
||||||
unset PYENV_DIR
|
unset PYENV_DIR
|
||||||
|
unset PYTHON_BUILD_HTTP_CLIENT
|
||||||
|
|
||||||
# guard against executing this block twice due to bats internals
|
# guard against executing this block twice due to bats internals
|
||||||
if [ -z "$PYENV_TEST_DIR" ]; then
|
if [ -z "$PYENV_TEST_DIR" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user