From 0aa021402c448c1673fb88d19aed4ee151d53637 Mon Sep 17 00:00:00 2001 From: Maksim Shilov <89912354+shilovmaksim@users.noreply.github.com> Date: Tue, 2 Nov 2021 17:26:25 +0300 Subject: [PATCH] [MacOS] Slight rework of the PyPy installation (#4394) --- images/macos/provision/core/pypy.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/images/macos/provision/core/pypy.sh b/images/macos/provision/core/pypy.sh index 08dd221a..eab31684 100644 --- a/images/macos/provision/core/pypy.sh +++ b/images/macos/provision/core/pypy.sh @@ -75,13 +75,14 @@ function InstallPyPy rm -f $PACKAGE_TAR_TEMP_PATH } -uri="https://downloads.python.org/pypy/" -pypyVersions=$(curl -4 -s --compressed $uri | grep 'osx64' | awk -v uri="$uri" -F'>|<' '{print uri$5}') +pypyVersions=$(curl https://downloads.python.org/pypy/versions.json) toolsetVersions=$(get_toolset_value '.toolcache[] | select(.name | contains("PyPy")) | .versions[]') -versionPattern="v[0-9]+\.[0-9]+\.[0-9]+-" for toolsetVersion in $toolsetVersions; do - latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-${versionPattern}" | head -1) + latestMajorPyPyVersion=$(echo $pypyVersions | + jq -r --arg toolsetVersion $toolsetVersion '.[] + | select((.python_version | startswith($toolsetVersion)) and .stable == true).files[] + | select(.platform == "darwin").download_url' | head -1) if [[ -z "$latestMajorPyPyVersion" ]]; then echo "Failed to get PyPy version '$toolsetVersion'" exit 1