"vscode:/vscode.git/clone" did not exist on "d79b3cd12f6a4e911d17492539da68b11e1a255d"
Unverified Commit afbff539 authored by Matthew Brett's avatar Matthew Brett Committed by GitHub
Browse files

Merge pull request #184 from matthew-brett/add-install-new-python

Add script to install new Python on Appveyor

Powershell script to download and install a new version of Python, if not present on the Appveyor image.

This should make it easier to get out wheels just after a Python release.
parents 99d8d0c0 dca515f6
...@@ -53,7 +53,6 @@ install: ...@@ -53,7 +53,6 @@ install:
# this repo includes a simple package to test appveyor # this repo includes a simple package to test appveyor
- git clone git://github.com/ogrisel/python-appveyor-demo.git - git clone git://github.com/ogrisel/python-appveyor-demo.git
build_script: build_script:
# Install build requirements # Install build requirements
- conda install --yes %BUILD_DEPENDS% - conda install --yes %BUILD_DEPENDS%
...@@ -75,3 +74,9 @@ test_script: ...@@ -75,3 +74,9 @@ test_script:
# run tests from install wheel # run tests from install wheel
- cd .. - cd ..
- python -m pyappveyordemo.tests.test_extension - python -m pyappveyordemo.tests.test_extension
# Smoke test of install_python script
- set PYTHON=C:\Python37
- ps: .\install_python.ps1
- set PYTHON=C:\Python37-x64
- ps: .\install_python.ps1
# Install specified Python version.
# Install only if:
# Our current matrix entry uses this Python version AND
# Python version is not already available.
$py_exe = "${env:PYTHON}\Python.exe"
if ( [System.IO.File]::Exists($py_exe) ) {
exit 0
}
$req_nodot = $env:PYTHON -replace '\D+Python(\d+)(?:-x64)?','$1'
$req_ver = $req_nodot -replace '(\d)(\d+)','$1.$2.0'
if ($env:PYTHON -eq "C:\Python${req_nodot}-x64") {
$exe_suffix="-amd64"
} elseif ($env:PYTHON -eq "C:\Python${req_nodot}") {
$exe_suffix=""
} else {
exit 0
}
$py_url = "https://www.python.org/ftp/python"
Write-Host "Installing Python ${req_ver}$exe_suffix..." -ForegroundColor Cyan
$exePath = "$env:TEMP\python-${req_ver}${exe_suffix}.exe"
$downloadFile = "$py_url/${req_ver}/python-${req_ver}${exe_suffix}.exe"
Write-Host "Downloading $downloadFile..."
(New-Object Net.WebClient).DownloadFile($downloadFile, $exePath)
Write-Host "Installing..."
cmd /c start /wait $exePath /quiet TargetDir="$env:PYTHON" Shortcuts=0 Include_launcher=0 InstallLauncherAllUsers=0
Write-Host "Python ${req_ver} installed to $env:PYTHON"
echo "$(& $py_exe --version 2> $null)"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment