how about this impressive construction?

previous version was constructing the value string wrong
This commit is contained in:
Jean-Paul Calderone 2023-08-09 10:44:00 -04:00
parent 139a329b38
commit 66177ae28e

View File

@ -207,11 +207,15 @@ jobs:
command: | command: |
# The Python for which we installed subunit is not necessarily on # The Python for which we installed subunit is not necessarily on
# %PATH% so put it there. # %PATH% so put it there.
# gets tools from packages we install.
$p = py -<<parameters.pythonVersion>> -c "import sys; print(sys.prefix)" $p = py -<<parameters.pythonVersion>> -c "import sys; print(sys.prefix)"
$q = py -<<parameters.pythonVersion>> -c "import sysconfig; print(sysconfig.get_path('scripts'))"
New-Item $Profile.CurrentUserAllHosts -Force New-Item $Profile.CurrentUserAllHosts -Force
# $p gets "python" on PATH and $p\Scripts # $p gets "python" on PATH and $q gets tools from packages we
Add-Content -Path $Profile.CurrentUserAllHosts -Value '$env:PATH = "$p;$p\Scripts;$env:PATH"' # install. Note we carefully construct the string so that
# $env:PATH is not substituted now but $p and $q are. ` is the
# PowerShell string escape character.
Add-Content -Path $Profile.CurrentUserAllHosts -Value "`$env:PATH = `"$p;$q;`$env:PATH`"'
- "run": - "run":
name: "Reveal $env:PATH" name: "Reveal $env:PATH"