Appveyor: Convert Python install script to PowerShell

Also install Python only if not already on wanted version
This commit is contained in:
Philipp Wolfer
2019-02-11 21:16:20 +01:00
parent 9e1fe4411f
commit d1485ea491
2 changed files with 14 additions and 9 deletions

View File

@@ -0,0 +1,13 @@
$CurrentVersion = python -c "import sys; print('%s.%s.%s' % sys.version_info[0:3])"
Write-Output "Python installed: $CurrentVersion, wanted: $env:PYTHON_VERSION"
if ($CurrentVersion -ne $env:PYTHON_VERSION) {
$InstallerUrl = 'https://www.python.org/ftp/python/' + $env:PYTHON_VERSION + '/python-' + $env:PYTHON_VERSION + '-amd64.exe'
Write-Output "Downloading and installing $InstallerUrl..."
(new-object net.webclient).DownloadFile($InstallerUrl, 'python-amd64.exe')
python-amd64.exe /quiet InstallAllUsers=1 TargetDir=%PYTHON% Include_doc=0 Include_tcltk=0 Include_test=0
python -m ensurepip
}
python --version
pip3 --version