Skip to content

Commit e4d0176

Browse files
committed
Force PCbuild to use configured Python
Resolve the python executable via Get-Command and set PYTHON and PYTHON_FOR_BUILD environment variables (erroring if python is not in PATH). This ensures PCbuild helper scripts use the configured Python executable instead of the py.exe launcher before invoking PCbuild\build.bat.
1 parent 43cd474 commit e4d0176

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

windows/package-for-dart.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ Write-Host "Downloading CPython source $PythonVersion"
3030
Invoke-WebRequest -Uri "https://www.python.org/ftp/python/$PythonVersion/Python-$PythonVersion.tgz" -OutFile $srcArchive
3131
tar -xf $srcArchive -C $srcRoot
3232

33+
# Force PCbuild helper scripts to use configured Python, not py.exe launcher.
34+
$pythonFromPath = (Get-Command python).Source
35+
if (-not $pythonFromPath) {
36+
throw "python was not found in PATH"
37+
}
38+
$env:PYTHON = $pythonFromPath
39+
$env:PYTHON_FOR_BUILD = $pythonFromPath
40+
3341
Push-Location $srcDir
3442
cmd /c "PCbuild\build.bat -e -p x64 -c Release"
3543
cmd /c "PCbuild\build.bat -e -p x64 -c Debug"

0 commit comments

Comments
 (0)