@@ -47,12 +47,18 @@ def install_package(*, uv: str, package: str):
47
47
action = "store_true" ,
48
48
help = "Set if the Python installation has an EXTERNALLY-MANAGED marker." ,
49
49
)
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
+ )
50
55
args = parser .parse_args ()
51
56
52
57
uv : str = os .path .abspath (args .uv ) if args .uv else "uv"
53
58
allow_externally_managed = (
54
59
["--break-system-packages" ] if args .externally_managed else []
55
60
)
61
+ python = ["--python" , args .python ] if args .python else []
56
62
57
63
# Create a temporary directory.
58
64
with tempfile .TemporaryDirectory () as temp_dir :
@@ -69,7 +75,8 @@ def install_package(*, uv: str, package: str):
69
75
logging .info ("Installing the package `pylint`." )
70
76
subprocess .run (
71
77
[uv , "pip" , "install" , "pylint" , "--system" , "--verbose" ]
72
- + allow_externally_managed ,
78
+ + allow_externally_managed
79
+ + python ,
73
80
cwd = temp_dir ,
74
81
check = True ,
75
82
)
@@ -94,7 +101,9 @@ def install_package(*, uv: str, package: str):
94
101
# Uninstall the package (`pylint`).
95
102
logging .info ("Uninstalling the package `pylint`." )
96
103
subprocess .run (
97
- [uv , "pip" , "uninstall" , "pylint" , "--system" ] + allow_externally_managed ,
104
+ [uv , "pip" , "uninstall" , "pylint" , "--system" ]
105
+ + allow_externally_managed
106
+ + python ,
98
107
cwd = temp_dir ,
99
108
check = True ,
100
109
)
0 commit comments