File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 22Initializer script that installs stuff to pip.
33"""
44
5+ from __future__ import annotations
6+
57import argparse
68import logging
79import os
10+ import shutil
811import subprocess
912import sys
1013import time
11- from typing import List
1214
1315
14- def run_command (args : List [str ]) -> " subprocess.CompletedProcess[bytes]" :
16+ def run_command (args : list [str ]) -> subprocess .CompletedProcess [bytes ]:
1517 logging .debug ("$ %s" , " " .join (args ))
1618 start_time = time .monotonic ()
1719 try :
@@ -50,7 +52,17 @@ def run_command(args: List[str]) -> "subprocess.CompletedProcess[bytes]":
5052 stream = sys .stderr ,
5153 )
5254
53- pip_args = ["pip3" , "install" ]
55+ uv_available = (
56+ any (prefix in sys .base_prefix for prefix in ["uv/python" , "uv\\ python" ])
57+ and shutil .which ("uv" ) is not None
58+ )
59+
60+ if uv_available :
61+ pip_args = ["uv" , "pip" , "install" ]
62+ elif sys .executable :
63+ pip_args = [sys .executable , "-mpip" , "install" ]
64+ else :
65+ pip_args = ["pip3" , "install" ]
5466
5567 # If we are in a global install, use `--user` to install so that you do not
5668 # need root access in order to initialize linters.
You can’t perform that action at this time.
0 commit comments