-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82b02bc
commit 8601ed5
Showing
1 changed file
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
$Version = $env:PYTHON_VERSION | ||
$PythonPath = $env:SETUP_PYTHON_PATH | ||
$Semver = $Version.Split('.') | ||
$pip = 0 | ||
Write-Output "Setting up pip for python $Version in path $PythonPath" | ||
if ([int]$Semver[0] -eq 3 -and [int]$Semver[1] -ge 4) { | ||
Write-Output "Using ensurepip..." | ||
Invoke-Expression -Command "$PythonPath -m ensurepip" | ||
if ([int]$Semver[1] -gt 4) { | ||
Write-Output "Updating pip..." | ||
Invoke-Expression -Command "$PythonPath -m pip install --upgrade pip" | ||
} | ||
$pip = 1 | ||
} elseif ([int]$Semver[1] -ge 3) { | ||
Write-Output "Using get_pip.py..." | ||
$GetPipFile = New-TemporaryFile | ||
Invoke-WebRequest -Uri 'https://bootstrap.pypa.io/pip/3.3/get-pip.py' -OutFile $GetPipFile | ||
Invoke-Expression -Command "$PythonPath $GetPipFile" | ||
Remove-Item $GetPipFile | ||
$pip = 1 | ||
} | ||
if ($pip) { | ||
if ([int]$Semver[0] -eq 3 -and [int]$Semver[1] -lt 5) { | ||
if ([int]$Semver[0] -eq 3 -and [int]$Semver[1] -lt 5) { | ||
if ([int]$Semver[1] -gt 2) { | ||
Write-Output "Using get_pip.py..." | ||
$VersionNumber = $Semver[0] | ||
$Major = $Semver[1] | ||
$GetPipFile = New-TemporaryFile | ||
Invoke-WebRequest -Uri "https://bootstrap.pypa.io/pip/$VersionNumber.$Major/get-pip.py" -OutFile $GetPipFile | ||
Invoke-Expression -Command "$PythonPath $GetPipFile" | ||
Write-Output "Installing typing for old Python versions..." | ||
Invoke-Expression -Command "$PythonPath -m pip install typing" | ||
Remove-Item $GetPipFile | ||
if ([int]$Semver[1] -eq 4) { | ||
Invoke-Expression -Command "$PythonPath -m pip install --upgrade wheel setuptools" | ||
} | ||
} else { | ||
Write-Output "Pip is not available for version $Version" | ||
Write-Output "Proceed with manualk installation at own risk" | ||
} | ||
} else { | ||
Write-Output "Using ensurepip..." | ||
Invoke-Expression -Command "$PythonPath -m ensurepip" | ||
Invoke-Expression -Command "$PythonPath -m pip install --upgrade pip" | ||
Write-Output "Installing wheel and setuptools..." | ||
Invoke-Expression -Command "$PythonPath -m pip install --upgrade wheel setuptools" | ||
} |