Skip to content
Snippets Groups Projects
Commit a3d29e2a authored by Lidi Zheng's avatar Lidi Zheng
Browse files

Ensure the installation process is finished

parent b7517110
No related branches found
No related tags found
No related merge requests found
...@@ -13,8 +13,8 @@ function Install-Python { ...@@ -13,8 +13,8 @@ function Install-Python {
[string]$PythonInstallPath, [string]$PythonInstallPath,
[string]$PythonInstallerHash [string]$PythonInstallerHash
) )
$PythonInstallerUrl = "https://www.python.org/ftp/python/$PythonVersion/$PythonInstaller" $PythonInstallerUrl = "https://www.python.org/ftp/python/$PythonVersion/$PythonInstaller.exe"
$PythonInstallerPath = "C:\tools\$PythonInstaller" $PythonInstallerPath = "C:\tools\$PythonInstaller.exe"
# Downloads installer # Downloads installer
Write-Host "Downloading the Python installer: $PythonInstallerUrl => $PythonInstallerPath" Write-Host "Downloading the Python installer: $PythonInstallerUrl => $PythonInstallerPath"
...@@ -55,6 +55,22 @@ function Install-Python { ...@@ -55,6 +55,22 @@ function Install-Python {
Start-Sleep -Seconds 1 Start-Sleep -Seconds 1
} }
# Waits until the installer process is gone
$ValidationStartTime = Get-Date
$EarlyExitDDL = $ValidationStartTime.addminutes(5)
While ($True) {
$CurrentTime = Get-Date
if ($CurrentTime -ge $EarlyExitDDL) {
throw "Python installation process hangs!"
}
$InstallProcess = Get-Process -Name $PythonInstaller
if ($InstallProcess -eq $null) {
Write-Host "Installation process exits normally."
break
}
Start-Sleep -Seconds 1
}
# Installs pip # Installs pip
& $PythonBinary -m ensurepip --user & $PythonBinary -m ensurepip --user
...@@ -63,7 +79,7 @@ function Install-Python { ...@@ -63,7 +79,7 @@ function Install-Python {
$Python38x86Config = @{ $Python38x86Config = @{
PythonVersion = "3.8.0" PythonVersion = "3.8.0"
PythonInstaller = "python-3.8.0.exe" PythonInstaller = "python-3.8.0"
PythonInstallPath = "C:\Python38_32bit" PythonInstallPath = "C:\Python38_32bit"
PythonInstallerHash = "412a649d36626d33b8ca5593cf18318c" PythonInstallerHash = "412a649d36626d33b8ca5593cf18318c"
} }
...@@ -71,7 +87,7 @@ Install-Python @Python38x86Config ...@@ -71,7 +87,7 @@ Install-Python @Python38x86Config
$Python38x64Config = @{ $Python38x64Config = @{
PythonVersion = "3.8.0" PythonVersion = "3.8.0"
PythonInstaller = "python-3.8.0-amd64.exe" PythonInstaller = "python-3.8.0-amd64"
PythonInstallPath = "C:\Python38" PythonInstallPath = "C:\Python38"
PythonInstallerHash = "29ea87f24c32f5e924b7d63f8a08ee8d" PythonInstallerHash = "29ea87f24c32f5e924b7d63f8a08ee8d"
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment