mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 22:26:56 +00:00
update PyPy download source (#901)
This commit is contained in:
committed by
GitHub
parent
8b72149ff7
commit
0d9b0822ae
@@ -74,8 +74,8 @@ function InstallPyPy
|
|||||||
|
|
||||||
function getPyPyVersions
|
function getPyPyVersions
|
||||||
{
|
{
|
||||||
uri="https://api.bitbucket.org/2.0/repositories/pypy/pypy/downloads?pagelen=100"
|
uri="https://downloads.python.org/pypy/"
|
||||||
curl -s -N $uri | jq -r ".values[].links.self.href|select(contains(\"linux64\"))"
|
wget -q -O - $uri | gunzip -c | grep 'linux64' | awk -v uri="$uri" -F'>|<' '{print uri$5}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Installation PyPy
|
# Installation PyPy
|
||||||
@@ -84,7 +84,7 @@ toolsetJson="$INSTALLER_SCRIPT_FOLDER/toolset.json"
|
|||||||
toolsetVersions=$(cat $toolsetJson | jq -r '.toolcache[] | select(.name | contains("PyPy")) | .versions[]')
|
toolsetVersions=$(cat $toolsetJson | jq -r '.toolcache[] | select(.name | contains("PyPy")) | .versions[]')
|
||||||
|
|
||||||
for toolsetVersion in $toolsetVersions; do
|
for toolsetVersion in $toolsetVersions; do
|
||||||
latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+-" | head -1)
|
latestMajorPyPyVersion=$(echo "${pypyVersions}" | grep -E "pypy${toolsetVersion}-v[0-9]+\.[0-9]+\.[0-9]+-" | head -1)
|
||||||
|
|
||||||
if [[ -z "$latestMajorPyPyVersion" ]]; then
|
if [[ -z "$latestMajorPyPyVersion" ]]; then
|
||||||
echo "Failed to get PyPy version '$toolsetVersion'"
|
echo "Failed to get PyPy version '$toolsetVersion'"
|
||||||
|
|||||||
@@ -3,13 +3,15 @@
|
|||||||
## Team: CI-Build
|
## Team: CI-Build
|
||||||
## Desc: Install PyPy
|
## Desc: Install PyPy
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
function Get-PyPyVersions
|
function Get-PyPyVersions
|
||||||
{
|
{
|
||||||
$uri = "https://api.bitbucket.org/2.0/repositories/pypy/pypy/downloads?pagelen=100"
|
$uri = "https://downloads.python.org/pypy/"
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
(Invoke-RestMethod -Uri $uri).Values
|
$hrefs = (Invoke-WebRequest -Uri $uri).Links.href
|
||||||
|
$hrefs | Where-Object {$_ -match '^pypy'} | Select-Object @{n = "Name"; e = {$_}}, @{n = "href"; e = {
|
||||||
|
[string]::Join('', ($uri, $_))
|
||||||
|
}}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -17,7 +19,6 @@ function Get-PyPyVersions
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Install-PyPy
|
function Install-PyPy
|
||||||
{
|
{
|
||||||
param(
|
param(
|
||||||
@@ -97,17 +98,14 @@ foreach($pypyTool in $pypyTools)
|
|||||||
{
|
{
|
||||||
# Query latest PyPy version
|
# Query latest PyPy version
|
||||||
$filter = '{0}{1}-*-{2}.zip' -f $pypyTool.name, $pypyVersion, $pypyTool.platform
|
$filter = '{0}{1}-*-{2}.zip' -f $pypyTool.name, $pypyVersion, $pypyTool.platform
|
||||||
$latestMajorPyPyVersion = $pypyVersions | Where-Object {
|
$latestMajorPyPyVersion = $pypyVersions | Where-Object {$_.name -like $filter} | Select-Object -First 1
|
||||||
$_.name -like $filter -and $_.name.Split('-')[1].Substring(1) -as [System.Version]
|
|
||||||
} | Sort-Object {[System.Version]$_.name.Split('-')[1].Substring(1)} | Select-Object -Last 1
|
|
||||||
|
|
||||||
if ($latestMajorPyPyVersion)
|
if ($latestMajorPyPyVersion)
|
||||||
{
|
{
|
||||||
$packageName = $latestMajorPyPyVersion.name
|
$packageName = $latestMajorPyPyVersion.name
|
||||||
$packageDate = $latestMajorPyPyVersion.created_on
|
|
||||||
|
|
||||||
Write-Host "Found PyPy '$packageName' package created on '$packageDate'"
|
Write-Host "Found PyPy '$packageName' package"
|
||||||
$url = $latestMajorPyPyVersion.links.self.href
|
$url = $latestMajorPyPyVersion.href
|
||||||
$tempPyPyPackagePath = Start-DownloadWithRetry -Url $url -Name $packageName
|
$tempPyPyPackagePath = Start-DownloadWithRetry -Url $url -Name $packageName
|
||||||
Install-PyPy -PackagePath $tempPyPyPackagePath -Architecture $pypyTool.arch
|
Install-PyPy -PackagePath $tempPyPyPackagePath -Architecture $pypyTool.arch
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user