Skip to content

Commit e137f2e

Browse files
authored
Refactor Python executable path extraction logic
Updated Python executable path extraction to trim whitespace.
1 parent 6f5eb5a commit e137f2e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/workflows/windows_concurrency_test.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ jobs:
6161
Write-Host "--- Priming Python environments ---"
6262
6363
$PYTHON_INFO = omnipkg info python 2>&1
64-
$PYTHON_39_EXE = ($PYTHON_INFO -split '\r?\n' | Select-String -Pattern 'Python 3.9:' | ForEach-Object { ($_ -split '\s+')[3] })
65-
$PYTHON_310_EXE = ($PYTHON_INFO -split '\r?\n' | Select-String -Pattern 'Python 3.10:' | ForEach-Object { ($_ -split '\s+')[3] })
66-
$PYTHON_311_EXE = ($PYTHON_INFO -split '\r?\n' | Select-String -Pattern 'Python 3.11:' | ForEach-Object { ($_ -split '\s+')[3] })
64+
# Use -split ':' then get the last part (the path) and trim whitespace
65+
$PYTHON_39_EXE = ($PYTHON_INFO -split '\r?\n' | Select-String -Pattern 'Python 3.9:' | ForEach-Object { ($_ -split ':',2)[1].Trim() })
66+
$PYTHON_310_EXE = ($PYTHON_INFO -split '\r?\n' | Select-String -Pattern 'Python 3.10:' | ForEach-Object { ($_ -split ':',2)[1].Trim() })
67+
$PYTHON_311_EXE = ($PYTHON_INFO -split '\r?\n' | Select-String -Pattern 'Python 3.11:' | ForEach-Object { ($_ -split ':',2)[1].Trim() })
6768
6869
if ($PYTHON_39_EXE) {
6970
Write-Host "Priming Python 3.9 by forcing KB rebuild..."

0 commit comments

Comments
 (0)