Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PYPY_VERSION file to the images #2285

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions images/linux/scripts/installers/pypy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
8 changes: 8 additions & 0 deletions images/macos/provision/core/pypy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
18 changes: 11 additions & 7 deletions images/win/scripts/Installers/Install-PyPy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,31 @@ 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)) {
Write-Host "Create PyPy toolcache folder"
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)
Expand Down