mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 20:56:47 +00:00
Add PYPY_VERSION file to the images (#2285)
* add PYPY_VERSION file * resolving comments * fix output for windows * add fix for windows
This commit is contained in:
@@ -33,6 +33,9 @@ function InstallPyPy
|
||||
|
||||
PACKAGE_TEMP_FOLDER="/tmp/$PACKAGE_NAME"
|
||||
PYTHON_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))")
|
||||
PYPY_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(*sys.pypy_version_info[0:3]))")
|
||||
echo "Put '$PYPY_FULL_VERSION' to PYPY_VERSION file"
|
||||
echo $PYPY_FULL_VERSION > "$PACKAGE_TEMP_FOLDER/PYPY_VERSION"
|
||||
|
||||
# PyPy folder structure
|
||||
PYPY_TOOLCACHE_PATH=$AGENT_TOOLSDIRECTORY/PyPy
|
||||
@@ -52,6 +55,7 @@ function InstallPyPy
|
||||
|
||||
echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)"
|
||||
cd $PYPY_TOOLCACHE_VERSION_ARCH_PATH/bin
|
||||
|
||||
ln -s $PYPY_MAJOR $PYTHON_MAJOR
|
||||
ln -s $PYTHON_MAJOR python
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ function InstallPyPy
|
||||
|
||||
PACKAGE_TEMP_FOLDER="/tmp/$PACKAGE_NAME"
|
||||
PYTHON_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))")
|
||||
PYPY_FULL_VERSION=$("$PACKAGE_TEMP_FOLDER/bin/$PYPY_MAJOR" -c "import sys;print('{}.{}.{}'.format(*sys.pypy_version_info[0:3]))")
|
||||
echo "Put '$PYPY_FULL_VERSION' to PYPY_VERSION file"
|
||||
echo $PYPY_FULL_VERSION > "$PACKAGE_TEMP_FOLDER/PYPY_VERSION"
|
||||
|
||||
# PyPy folder structure
|
||||
PYPY_TOOLCACHE_PATH=$AGENT_TOOLSDIRECTORY/PyPy
|
||||
@@ -50,6 +53,11 @@ function InstallPyPy
|
||||
|
||||
echo "Create additional symlinks (Required for UsePythonVersion Azure DevOps task)"
|
||||
cd $PYPY_TOOLCACHE_VERSION_ARCH_PATH/bin
|
||||
|
||||
PYPY_FULL_VERSION=$(./$PYPY_MAJOR -c "import sys;print('{}.{}.{}'.format(*sys.pypy_version_info[0:3]))")
|
||||
echo "PYPY_FULL_VERSION is $PYPY_FULL_VERSION"
|
||||
echo $PYPY_FULL_VERSION > "PYPY_VERSION"
|
||||
|
||||
ln -s $PYPY_MAJOR $PYTHON_MAJOR
|
||||
ln -s $PYTHON_MAJOR python
|
||||
|
||||
|
||||
@@ -34,13 +34,17 @@ function Install-PyPy
|
||||
# Get Python version from binaries
|
||||
$pypyApp = Get-ChildItem -Path "$tempFolder\pypy*.exe" | Where-Object Name -match "pypy(\d+)?.exe"
|
||||
$pypyName = $pypyApp.Name
|
||||
$pypyVersion = & $pypyApp -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))"
|
||||
$pythonVersion = & $pypyApp -c "import sys;print('{}.{}.{}'.format(sys.version_info[0],sys.version_info[1],sys.version_info[2]))"
|
||||
|
||||
if ($pypyVersion)
|
||||
$pypyFullVersion = & $pypyApp -c "import sys;print('{}.{}.{}'.format(*sys.pypy_version_info[0:3]))"
|
||||
Write-Host "Put '$pypyFullVersion' to PYPY_VERSION file"
|
||||
New-Item -Path "$tempFolder\PYPY_VERSION" -Value $pypyFullVersion
|
||||
|
||||
if ($pythonVersion)
|
||||
{
|
||||
Write-Host "Installing PyPy $pypyVersion"
|
||||
Write-Host "Installing PyPy $pythonVersion"
|
||||
$pypyToolcachePath = Join-Path -Path $env:AGENT_TOOLSDIRECTORY -ChildPath "PyPy"
|
||||
$pypyVersionPath = Join-Path -Path $pypyToolcachePath -ChildPath $pypyVersion
|
||||
$pypyVersionPath = Join-Path -Path $pypyToolcachePath -ChildPath $pythonVersion
|
||||
$pypyArchPath = Join-Path -Path $pypyVersionPath -ChildPath $architecture
|
||||
|
||||
if (-not (Test-Path $pypyToolcachePath)) {
|
||||
@@ -48,13 +52,13 @@ function Install-PyPy
|
||||
New-Item -ItemType Directory -Path $pypyToolcachePath | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Create PyPy '${pypyVersion}' folder in '${pypyVersionPath}'"
|
||||
Write-Host "Create PyPy '${pythonVersion}' folder in '${pypyVersionPath}'"
|
||||
New-Item -ItemType Directory -Path $pypyVersionPath -Force | Out-Null
|
||||
|
||||
Write-Host "Move PyPy '${pypyVersion}' files to '${pypyArchPath}'"
|
||||
Write-Host "Move PyPy '${pythonVersion}' files to '${pypyArchPath}'"
|
||||
Move-Item -Path $tempFolder -Destination $pypyArchPath | Out-Null
|
||||
|
||||
Write-Host "Install PyPy '${pypyVersion}' in '${pypyArchPath}'"
|
||||
Write-Host "Install PyPy '${pythonVersion}' in '${pypyArchPath}'"
|
||||
cmd.exe /c "cd /d $pypyArchPath && mklink python.exe $pypyName && python.exe -m ensurepip && python.exe -m pip install --upgrade pip"
|
||||
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
|
||||
Reference in New Issue
Block a user