mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Allow overriding aria2c/curl/wget via environment variable (#534)
This commit is contained in:
parent
fbc40aae77
commit
cd8f61b5e0
4 changed files with 13 additions and 24 deletions
|
@ -336,45 +336,27 @@ http() {
|
||||||
}
|
}
|
||||||
|
|
||||||
http_head_aria2c() {
|
http_head_aria2c() {
|
||||||
options=""
|
aria2c --dry-run ${ARIA2_OPTS} "$1" >&4 2>&1
|
||||||
[ -n "${IPV4}" ] && options="--disable-ipv6=true"
|
|
||||||
[ -n "${IPV6}" ] && options="--disable-ipv6=false"
|
|
||||||
aria2c --dry-run ${options} "$1" >&4 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
http_get_aria2c() {
|
http_get_aria2c() {
|
||||||
options=""
|
aria2c -o "${2:--}" ${ARIA2_OPTS} "$1"
|
||||||
[ -n "${IPV4}" ] && options="--disable-ipv6=true"
|
|
||||||
[ -n "${IPV6}" ] && options="--disable-ipv6=false"
|
|
||||||
aria2c -o "${2:--}" ${options} "$1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
http_head_curl() {
|
http_head_curl() {
|
||||||
options=""
|
curl -qsILf ${CURL_OPTS} "$1" >&4 2>&1
|
||||||
[ -n "${IPV4}" ] && options="--ipv4"
|
|
||||||
[ -n "${IPV6}" ] && options="--ipv6"
|
|
||||||
curl -qsILf ${options} "$1" >&4 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
http_get_curl() {
|
http_get_curl() {
|
||||||
options=""
|
curl -q -o "${2:--}" -sSLf ${CURL_OPTS} "$1"
|
||||||
[ -n "${IPV4}" ] && options="--ipv4"
|
|
||||||
[ -n "${IPV6}" ] && options="--ipv6"
|
|
||||||
curl -q -o "${2:--}" -sSLf ${options} "$1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
http_head_wget() {
|
http_head_wget() {
|
||||||
options=""
|
wget -q --spider ${WGET_OPTS} "$1" >&4 2>&1
|
||||||
[ -n "${IPV4}" ] && options="--inet4-only"
|
|
||||||
[ -n "${IPV6}" ] && options="--inet6-only"
|
|
||||||
wget -q --spider ${options} "$1" >&4 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
http_get_wget() {
|
http_get_wget() {
|
||||||
options=""
|
wget -nv ${WGET_OPTS} -O "${2:--}" "$1"
|
||||||
[ -n "${IPV4}" ] && options="--inet4-only"
|
|
||||||
[ -n "${IPV6}" ] && options="--inet6-only"
|
|
||||||
wget -nv ${options} -O "${2:--}" "$1"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch_tarball() {
|
fetch_tarball() {
|
||||||
|
@ -1816,6 +1798,10 @@ if [ -n "$PYTHON_BUILD_SKIP_MIRROR" ] || ! has_checksum_support compute_sha2; th
|
||||||
unset PYTHON_BUILD_MIRROR_URL
|
unset PYTHON_BUILD_MIRROR_URL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ARIA2_OPTS="${PYTHON_BUILD_ARIA2_OPTS} ${IPV4+--disable-ipv6=true} ${IPV6+--disable-ipv6=false}"
|
||||||
|
CURL_OPTS="${PYTHON_BUILD_CURL_OPTS} ${IPV4+--ipv4} ${IPV6+--ipv6}"
|
||||||
|
WGET_OPTS="${PYTHON_BUILD_WGET_OPTS} ${IPV4+--inet4-only} ${IPV6+--inet6-only}"
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
load test_helper
|
load test_helper
|
||||||
export PYTHON_BUILD_SKIP_MIRROR=1
|
export PYTHON_BUILD_SKIP_MIRROR=1
|
||||||
export PYTHON_BUILD_CACHE_PATH="$TMP/cache"
|
export PYTHON_BUILD_CACHE_PATH="$TMP/cache"
|
||||||
|
unset PYTHON_BUILD_ARIA2_OPTS
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
mkdir "$PYTHON_BUILD_CACHE_PATH"
|
mkdir "$PYTHON_BUILD_CACHE_PATH"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
load test_helper
|
load test_helper
|
||||||
export PYTHON_BUILD_SKIP_MIRROR=1
|
export PYTHON_BUILD_SKIP_MIRROR=1
|
||||||
export PYTHON_BUILD_CACHE_PATH=
|
export PYTHON_BUILD_CACHE_PATH=
|
||||||
|
unset PYTHON_BUILD_ARIA2_OPTS
|
||||||
|
|
||||||
|
|
||||||
@test "package URL without checksum" {
|
@test "package URL without checksum" {
|
||||||
|
|
|
@ -4,6 +4,7 @@ load test_helper
|
||||||
export PYTHON_BUILD_SKIP_MIRROR=
|
export PYTHON_BUILD_SKIP_MIRROR=
|
||||||
export PYTHON_BUILD_CACHE_PATH=
|
export PYTHON_BUILD_CACHE_PATH=
|
||||||
export PYTHON_BUILD_MIRROR_URL=http://mirror.example.com
|
export PYTHON_BUILD_MIRROR_URL=http://mirror.example.com
|
||||||
|
unset PYTHON_BUILD_ARIA2_OPTS
|
||||||
|
|
||||||
|
|
||||||
@test "package URL without checksum bypasses mirror" {
|
@test "package URL without checksum bypasses mirror" {
|
||||||
|
|
Loading…
Reference in a new issue