@@ -21,7 +21,7 @@ local REQUEST_HEADERS = {
2121 [" User-Agent" ] = " vfox"
2222}
2323
24- -- vfox adds both the install root and install root\Scripts to PATH on Windows .
24+ -- pip.cmd lives under Scripts, so %~dp0..\python.exe resolves to the install root's python.exe .
2525local WINDOWS_PIP_SHIM_CONTENT = " @echo off\r\n\" %~dp0..\\ python.exe\" -m pip %*\r\n "
2626
2727local UV_BUILD_ENV = " VFOX_PYTHON_USE_UV_BUILD"
@@ -577,7 +577,7 @@ local function ensureWindowsDirectory(path)
577577 local command = powerShellCommand (" New-Item -ItemType Directory -Force -Path " .. powerShellQuote (path ) .. " | Out-Null" )
578578 local exitCode = os.execute (command )
579579 if not commandSucceeded (exitCode ) then
580- error (" Failed to create directory: " .. path .. " . Command: " .. command .. " . Exit code: " .. tostring (exitCode ))
580+ error (" Failed to create directory: " .. path .. " . Exit code: " .. tostring (exitCode ))
581581 end
582582end
583583
@@ -599,6 +599,10 @@ local function createWindowsPipShim(scriptsPath)
599599 end
600600end
601601
602+ local function windowsPipCommandExists (scriptsPath )
603+ return pathExists (scriptsPath .. " \\ pip.exe" ) or pathExists (scriptsPath .. " \\ pip.cmd" )
604+ end
605+
602606local function ensureWindowsUvBuildPip (path )
603607 if runtimeOs () ~= " windows" then
604608 return
@@ -610,7 +614,7 @@ local function ensureWindowsUvBuildPip(path)
610614 error (" Cannot install pip: python.exe was not found at " .. pythonExe )
611615 end
612616 -- If Scripts does not exist yet, pathExists returns false and setup continues.
613- if pathExists (scriptsPath .. " \\ pip.exe " ) or pathExists ( scriptsPath .. " \\ pip.cmd " ) then
617+ if windowsPipCommandExists (scriptsPath ) then
614618 return
615619 end
616620
@@ -626,7 +630,7 @@ local function ensureWindowsUvBuildPip(path)
626630 error (" ensurepip failed while installing pip. Exit code: " .. tostring (exitCode ))
627631 end
628632
629- if pathExists (scriptsPath .. " \\ pip.exe " ) then
633+ if windowsPipCommandExists (scriptsPath ) then
630634 return
631635 end
632636
@@ -646,7 +650,7 @@ local function ensureWindowsUvBuildPip(path)
646650 error (" pip module is not available after installation attempts. Exit code: " .. tostring (exitCode ))
647651 end
648652
649- if not pathExists (scriptsPath .. " \\ pip.exe " ) then
653+ if not windowsPipCommandExists (scriptsPath ) then
650654 createWindowsPipShim (scriptsPath )
651655 end
652656end
0 commit comments