@@ -46,9 +46,19 @@ def virtualenv(python_executable: str = sys.executable) -> Iterator[tuple[str, s
46
46
yield venv_dir , os .path .abspath (os .path .join (venv_dir , "bin" , "python" ))
47
47
48
48
49
- def upgrade_pip (python_executable : str , version_str : str ) -> None :
50
- """Install a newer pip version."""
51
- install_cmd = [python_executable , "-m" , "pip" , "install" , f"pip{ version_str } " ]
49
+ def upgrade_pip (python_executable : str ) -> None :
50
+ """Install pip>=21.3.1. Required for editable installs with PEP 660."""
51
+ if (
52
+ sys .version_info >= (3 , 11 )
53
+ or (3 , 10 , 3 ) <= sys .version_info < (3 , 11 )
54
+ or (3 , 9 , 11 ) <= sys .version_info < (3 , 10 )
55
+ or (3 , 8 , 13 ) <= sys .version_info < (3 , 9 )
56
+ ):
57
+ # Skip for more recent Python release which come with pip>=21.3.1
58
+ # out of the box - for performance reasons.
59
+ return
60
+
61
+ install_cmd = [python_executable , "-m" , "pip" , "install" , "pip>=21.3.1" ]
52
62
try :
53
63
with filelock .FileLock (pip_lock , timeout = pip_timeout ):
54
64
proc = subprocess .run (install_cmd , capture_output = True , env = os .environ )
@@ -107,7 +117,7 @@ def test_pep561(testcase: DataDrivenTestCase) -> None:
107
117
venv_dir , python_executable = venv
108
118
if editable :
109
119
# Editable installs with PEP 660 require pip>=21.3
110
- upgrade_pip (python_executable , ">=21.3.1" )
120
+ upgrade_pip (python_executable )
111
121
for pkg in pkgs :
112
122
install_package (pkg , python_executable , editable )
113
123
0 commit comments