@@ -47,12 +47,18 @@ def install_package(*, uv: str, package: str):
4747 action = "store_true" ,
4848 help = "Set if the Python installation has an EXTERNALLY-MANAGED marker." ,
4949 )
50+ parser .add_argument (
51+ "--python" ,
52+ required = False ,
53+ help = "Set if the system Python version must be explicitly specified, e.g., for prereleases." ,
54+ )
5055 args = parser .parse_args ()
5156
5257 uv : str = os .path .abspath (args .uv ) if args .uv else "uv"
5358 allow_externally_managed = (
5459 ["--break-system-packages" ] if args .externally_managed else []
5560 )
61+ python = ["--python" , args .python ] if args .python else []
5662
5763 # Create a temporary directory.
5864 with tempfile .TemporaryDirectory () as temp_dir :
@@ -69,7 +75,8 @@ def install_package(*, uv: str, package: str):
6975 logging .info ("Installing the package `pylint`." )
7076 subprocess .run (
7177 [uv , "pip" , "install" , "pylint" , "--system" , "--verbose" ]
72- + allow_externally_managed ,
78+ + allow_externally_managed
79+ + python ,
7380 cwd = temp_dir ,
7481 check = True ,
7582 )
@@ -94,7 +101,9 @@ def install_package(*, uv: str, package: str):
94101 # Uninstall the package (`pylint`).
95102 logging .info ("Uninstalling the package `pylint`." )
96103 subprocess .run (
97- [uv , "pip" , "uninstall" , "pylint" , "--system" ] + allow_externally_managed ,
104+ [uv , "pip" , "uninstall" , "pylint" , "--system" ]
105+ + allow_externally_managed
106+ + python ,
98107 cwd = temp_dir ,
99108 check = True ,
100109 )
0 commit comments