@@ -21,6 +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.
2425local WINDOWS_PIP_SHIM_CONTENT = " @echo off\r\n\" %~dp0..\\ python.exe\" -m pip %*\r\n "
2526
2627local UV_BUILD_ENV = " VFOX_PYTHON_USE_UV_BUILD"
@@ -591,15 +592,14 @@ end
591592
592593local function createWindowsPipShim (installPath , version )
593594 local major , minor = string.match (version , " ^(%d+)%.(%d+)" )
595+ if major == nil or minor == nil then
596+ error (" Cannot create pip shim for unexpected Python version: " .. version )
597+ end
594598 local scriptsPath = installPath .. " \\ Scripts"
595599 ensureWindowsDirectory (scriptsPath )
596600
597601 local shims = { " pip.cmd" , " pip3.cmd" }
598- if major ~= nil and minor ~= nil then
599- table.insert (shims , " pip" .. major .. " ." .. minor .. " .cmd" )
600- else
601- print (" Warning: unable to create versioned pip shim for unexpected Python version: " .. version )
602- end
602+ table.insert (shims , " pip" .. major .. " ." .. minor .. " .cmd" )
603603 for _ , shim in ipairs (shims ) do
604604 writeWindowsFile (scriptsPath .. " \\ " .. shim , WINDOWS_PIP_SHIM_CONTENT )
605605 end
@@ -614,6 +614,7 @@ local function ensureWindowsUvBuildPip(path, version)
614614 if not pathExists (pythonExe ) then
615615 error (" Cannot install pip: python.exe was not found at " .. pythonExe )
616616 end
617+ -- If Scripts does not exist yet, pathExists returns false and setup continues.
617618 if pathExists (path .. " \\ Scripts\\ pip.exe" ) or pathExists (path .. " \\ Scripts\\ pip.cmd" ) then
618619 return
619620 end
0 commit comments