Unverified Commit 643d202b authored by Matthew Brett's avatar Matthew Brett Committed by GitHub
Browse files

Merge pull request #271 from mattip/fix-install_python

MRG: Fix regexp and be more verbose

The previous regexp did not work, and the script exited without complaining.

xref MacPython/numpy-wheels#66
parents dc357469 11a389d7
...@@ -83,3 +83,9 @@ test_script: ...@@ -83,3 +83,9 @@ test_script:
- ps: .\install_python.ps1 - ps: .\install_python.ps1
- set PYTHON=C:\Python38-x64 - set PYTHON=C:\Python38-x64
- ps: .\install_python.ps1 - ps: .\install_python.ps1
- set PYTHON=C:\Python38rc1-x64
- ps: .\install_python.ps1
- set PYTHON=C:\Python38
- ps: .\install_python.ps1
- set PYTHON=C:\Python38rc1
- ps: .\install_python.ps1
...@@ -5,22 +5,22 @@ ...@@ -5,22 +5,22 @@
$py_exe = "${env:PYTHON}\Python.exe" $py_exe = "${env:PYTHON}\Python.exe"
if ( [System.IO.File]::Exists($py_exe) ) { if ( [System.IO.File]::Exists($py_exe) ) {
echo "$py_exe exists"
exit 0 exit 0
} }
$req_nodot = $env:PYTHON -replace '\D+Python(\d+(?:rc\d+))(?:-x64)?','$1' $req_nodot = $env:PYTHON -replace '\D+Python(\d+(?:rc\d+)?)(-x64)?','$1'
$req_ver = $req_nodot -replace '(\d)(\d+)','$1.$2.0' $req_ver = $req_nodot -replace '(\d)(\d+)','$1.$2.0'
$req_dir = $req_nodot -replace '(\d)(\d+)(.*)','$1.$2.0' $req_dir = $req_nodot -replace '(\d)(\d+)(.*)','$1.$2.0'
$last_three = $env:PYTHON[-3 .. -1] -join ''
if ($env:PYTHON -eq "C:\Python${req_nodot}-x64") { if ($last_three -eq "x64") {
$exe_suffix="-amd64" $exe_suffix="-amd64"
} elseif ($env:PYTHON -eq "C:\Python${req_nodot}") {
$exe_suffix=""
} else { } else {
exit 0 $exe_suffix=""
} }
$py_url = "https://www.python.org/ftp/python" $py_url = "https://www.python.org/ftp/python"
Write-Host "Installing Python ${req_ver}$exe_suffix..." -ForegroundColor Cyan Write-Host "Installing Python ${req_dir}/${req_ver}$exe_suffix to $env:Python ..." -ForegroundColor Cyan
$exePath = "$env:TEMP\python-${req_ver}${exe_suffix}.exe" $exePath = "$env:TEMP\python-${req_ver}${exe_suffix}.exe"
$downloadFile = "$py_url/${req_dir}/python-${req_ver}${exe_suffix}.exe" $downloadFile = "$py_url/${req_dir}/python-${req_ver}${exe_suffix}.exe"
......
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