@@ -259,6 +259,14 @@ local function shellQuote(value)
259259 return " '" .. string.gsub (value , " '" , " '\\ ''" ) .. " '"
260260end
261261
262+ local function powerShellCommand (script , args )
263+ local command = " powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command " .. shellQuote (script )
264+ for _ , arg in ipairs (args ) do
265+ command = command .. " " .. shellQuote (arg )
266+ end
267+ return command
268+ end
269+
262270local function startsWith (value , prefix )
263271 return string.sub (value , 1 , string.len (prefix )) == prefix
264272end
@@ -548,7 +556,7 @@ local function ensureWindowsUvBuildPip(path)
548556 end
549557
550558 print (" Installing pip for uv-build Python on Windows..." )
551- local command = string.format ( " %s -E -s -m ensurepip -U --default-pip" , shellQuote ( pythonExe ) )
559+ local command = powerShellCommand ( " & { & $args[0] -E -s -m ensurepip -U --default-pip } " , { pythonExe } )
552560 local exitCode = os.execute (command )
553561 if not commandSucceeded (exitCode ) then
554562 error (" ensurepip failed while installing pip. Exit code: " .. tostring (exitCode ))
@@ -558,8 +566,8 @@ local function ensureWindowsUvBuildPip(path)
558566 return
559567 end
560568
561- command = string.format ( " %s -E -s -m pip install --force-reinstall --no-index --find-links %s pip" ,
562- shellQuote ( pythonExe ), shellQuote ( path .. " \\ Lib\\ ensurepip\\ _bundled" ) )
569+ command = powerShellCommand ( " & { & $args[0] -E -s -m pip install --force-reinstall --no-index --find-links $args[1] pip } " ,
570+ { pythonExe , path .. " \\ Lib\\ ensurepip\\ _bundled" } )
563571 exitCode = os.execute (command )
564572 if not commandSucceeded (exitCode ) then
565573 error (" pip force-reinstall failed while creating pip scripts. Exit code: " .. tostring (exitCode ))
0 commit comments