@@ -590,32 +590,27 @@ local function writeWindowsFile(path, content)
590590 file :close ()
591591end
592592
593- local function createWindowsPipShim (installPath , version )
594- 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
598- local scriptsPath = installPath .. " \\ Scripts"
593+ local function createWindowsPipShim (scriptsPath )
599594 ensureWindowsDirectory (scriptsPath )
600595
601596 local shims = { " pip.cmd" , " pip3.cmd" }
602- table.insert (shims , " pip" .. major .. " ." .. minor .. " .cmd" )
603597 for _ , shim in ipairs (shims ) do
604598 writeWindowsFile (scriptsPath .. " \\ " .. shim , WINDOWS_PIP_SHIM_CONTENT )
605599 end
606600end
607601
608- local function ensureWindowsUvBuildPip (path , version )
602+ local function ensureWindowsUvBuildPip (path )
609603 if runtimeOs () ~= " windows" then
610604 return
611605 end
612606
613607 local pythonExe = path .. " \\ python.exe"
608+ local scriptsPath = path .. " \\ Scripts"
614609 if not pathExists (pythonExe ) then
615610 error (" Cannot install pip: python.exe was not found at " .. pythonExe )
616611 end
617612 -- If Scripts does not exist yet, pathExists returns false and setup continues.
618- if pathExists (path .. " \\ Scripts \\ pip.exe" ) or pathExists (path .. " \\ Scripts \\ pip.cmd" ) then
613+ if pathExists (scriptsPath .. " \\ pip.exe" ) or pathExists (scriptsPath .. " \\ pip.cmd" ) then
619614 return
620615 end
621616
@@ -631,7 +626,7 @@ local function ensureWindowsUvBuildPip(path, version)
631626 error (" ensurepip failed while installing pip. Exit code: " .. tostring (exitCode ))
632627 end
633628
634- if pathExists (path .. " \\ Scripts \\ pip.exe" ) then
629+ if pathExists (scriptsPath .. " \\ pip.exe" ) then
635630 return
636631 end
637632
@@ -651,8 +646,8 @@ local function ensureWindowsUvBuildPip(path, version)
651646 error (" pip module is not available after installation attempts. Exit code: " .. tostring (exitCode ))
652647 end
653648
654- if not pathExists (path .. " \\ Scripts \\ pip.exe" ) then
655- createWindowsPipShim (path , version )
649+ if not pathExists (scriptsPath .. " \\ pip.exe" ) then
650+ createWindowsPipShim (scriptsPath )
656651 end
657652end
658653
@@ -751,7 +746,7 @@ function uvBuildInstall(ctx)
751746 if OS_TYPE ~= " windows" then
752747 fixShebangLines (extractedPath )
753748 else
754- ensureWindowsUvBuildPip (extractedPath , version )
749+ ensureWindowsUvBuildPip (extractedPath )
755750 end
756751
757752 print (" Install Python uv-build success!" )
0 commit comments