Add retries to get PyPy version (#933)

* add retries to get PyPy version

* replace wget to curl
This commit is contained in:
Aleksandr Chebotov
2020-05-25 12:35:06 +03:00
committed by GitHub
parent 85cc4ed839
commit 5e7a5aeedd

View File

@@ -7,9 +7,6 @@
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
# Fail out if any setups fail
set -e
# This function installs PyPy using the specified arguments:
# $1=PACKAGE_URL
function InstallPyPy
@@ -75,7 +72,21 @@ function InstallPyPy
function getPyPyVersions
{
uri="https://downloads.python.org/pypy/"
wget -q -O - $uri | gunzip -c | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}'
i=20
while [ $i -gt 0 ]; do
((i--))
result="$(curl -4 -s --compressed $uri | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}')"
if [ -z "$result" ]; then
sleep 30
else
echo "$result"
return
fi
done
echo "There are no more attempts to retrive PyPy version"
exit 1
}
# Installation PyPy
@@ -83,6 +94,9 @@ pypyVersions=$(getPyPyVersions)
toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json"
toolsetVersions=$(cat $toolsetJson | jq -r '.toolcache[] | select(.name | contains("PyPy")) | .versions[]')
# Fail out if any setups fail
set -e
for toolsetVersion in $toolsetVersions; do
latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-v[0-9]+\.[0-9]+\.[0-9]+-" | head -1)