Skip to content
Merged
Changes from all commits
Commits
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
17 changes: 9 additions & 8 deletions scripts/install/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@ function FindLatestPythonExecutableInRegistry {
$PythonCoreRegistryLocation = "${RootRegistryLocation}:\Software\Python\PythonCore"
if (Test-Path $PythonCoreRegistryLocation) {
LogOutput "Python found in registry: $PythonCoreRegistryLocation"

$PythonInstallations = (Get-ChildItem -recurse $PythonCoreRegistryLocation) | Sort-Object -Descending
ForEach ($Installation in $PythonInstallations) {
# we are sorting by descending so this will grab the greatest installed version of python
If ($installation.Name.EndsWith("\InstallPath")) {
$PythonInstallLocation = (Get-ItemProperty -LiteralPath $Installation.PSPath).'(default)'
return Join-Path $PythonInstallLocation "python.exe"
}
}
if ($PythonInstallations) {
ForEach ($Installation in $PythonInstallations) {
# we are sorting by descending so this will grab the greatest installed version of python
If ($installation.Name.EndsWith("\InstallPath")) {
$PythonInstallLocation = (Get-ItemProperty -LiteralPath $Installation.PSPath).'(default)'
return Join-Path $PythonInstallLocation "python.exe"
}
}
}
}

return $PythonExecutable
Expand Down