Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6727a94
Check for OS-Bitness rather than Processor Architecture
rahulrajaram Apr 21, 2019
6db1e26
Extract logic to determine Python installation URL into a function
rahulrajaram Apr 21, 2019
307c0db
Modify verbiage indicating Python will be installed silently
rahulrajaram Apr 21, 2019
74407d5
Rename $python -> $PythonInstaller in install-python.ps1
rahulrajaram Apr 21, 2019
a90eb41
Exit install-python.ps1 with non-0 code if MSI download fails
rahulrajaram Apr 21, 2019
ee21ee5
Extract logic to install Python into a function
rahulrajaram Apr 21, 2019
9079800
Avoid closing existing shell after installation completion
rahulrajaram Apr 21, 2019
c27746b
Bring up Python MSI rather than install in the background
rahulrajaram Apr 21, 2019
d40f64d
Remove previously downloaded Python MSI exe before new attempt to dow…
rahulrajaram Apr 21, 2019
9576d5c
Update PATH current session after installation
rahulrajaram Apr 21, 2019
8078c03
Rename Download-Python -> Get-PythonMSI
rahulrajaram Apr 21, 2019
59bb41e
Rename Assert-IsPythonRequired -> Get-PythonExecutable/Change return …
rahulrajaram Apr 21, 2019
b3b5433
Handle user-triggered exits from the installer specially
rahulrajaram Apr 21, 2019
751b53e
Rename install-python.ps1 -> .\scripts\install-python.ps1
rahulrajaram Apr 21, 2019
e71f0c1
Create a function to echo step titles
rahulrajaram Apr 21, 2019
ea539f7
Highlight success/failure messages printed by install-python.ps1 in g…
rahulrajaram Apr 21, 2019
db8262f
Install virtualenv after completing python installation
rahulrajaram Apr 21, 2019
69759fe
Create a PS1/BAT script to install Python and the EBCLI
rahulrajaram Apr 21, 2019
7cb76dc
Exit Python installation script following installation failures
rahulrajaram Apr 22, 2019
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
36 changes: 13 additions & 23 deletions install-python.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,21 @@ function Cleanup {
Stop-Process $PID
}

function Download-Python {
$arch ="$env:PROCESSOR_ARCHITECTURE"
$url = ""

switch($arch) {
"amd64" {
Write-Host "Downloading x64 version of Python."
$url = "https://www.python.org/ftp/python/3.7.3/python-3.7.3-amd64-webinstall.exe"
}
"x86" {
Write-Host "Downloading x86 version of Python."
$url = "https://www.python.org/ftp/python/3.7.3/python-3.7.3-webinstall.exe"
}
default {
Write-Host "Unable to determine the Python download url for processor type: $arch."
}
}

if (-not ([string]::IsNullOrEmpty($url))) {
$client = New-Object System.Net.WebClient
$client.DownloadFile($url, $python)
return $True
function Get-PythonInstallationTarget {
if ([Environment]::Is64BitOperatingSystem) {
Write-Host "Downloading x64 version of Python."
return "https://www.python.org/ftp/python/3.7.3/python-3.7.3-amd64-webinstall.exe"
} else {
Write-Host "Downloading x86 version of Python."
return "https://www.python.org/ftp/python/3.7.3/python-3.7.3-webinstall.exe"
}
}

return $False
function Download-Python {
$url = Get-PythonInstallationTarget
$client = New-Object System.Net.WebClient
$client.DownloadFile($url, $PythonInstaller)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this fails, returning $True doesn't make sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is eliminate in a future commit.

return $True
}

if (Assert-IsPythonRequired) {
Expand Down