Skip to content

Commit 55bd1a7

Browse files
Copilotbytemain
andauthored
Use PowerShell for Windows uv-build pip
Agent-Logs-Url: https://github.com/version-fox/vfox-python/sessions/62cb80ef-ebad-4aa5-8791-70cc74b8efc5 Co-authored-by: bytemain <13938334+bytemain@users.noreply.github.com>
1 parent 5b2a127 commit 55bd1a7

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

lib/util.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,14 @@ local function shellQuote(value)
259259
return "'" .. string.gsub(value, "'", "'\\''") .. "'"
260260
end
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+
262270
local function startsWith(value, prefix)
263271
return string.sub(value, 1, string.len(prefix)) == prefix
264272
end
@@ -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

Comments
 (0)