Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions run
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ class Runner:
)
sys.exit(1)

self.uv_path = shutil.which('uv')
if self.uv_path is None and self.args.command not in ('help', 'tests'):
print('You need to have `uv` installed to run this script')
sys.exit(2)
self.uv_path = None

self.venv = None
if 'VIRTUAL_ENV' in os.environ:
Expand All @@ -78,10 +75,15 @@ class Runner:
sys.stdout.reconfigure(line_buffering=True)
self.parse_args(argv)

self.uv_path = shutil.which('uv')
if self.uv_path is None and self.args.command not in ('help', 'tests'):
print('You need to have `uv` installed to run this script')
return 2

if not self.is_supported_python_version():
return 1

if not self.venv and self.args.command != 'devenv':
if self.uv_path and not self.venv and self.args.command != 'devenv':
is_uv = 'UV' in os.environ
if not is_uv:
run_cmd = ['uv', 'run', '--isolated']
Expand All @@ -102,7 +104,11 @@ class Runner:
or self.args.command == 'presubmit'
)
):
venv_path = self.venv.replace(THIS_DIR, '/')
venv_path = (
self.venv.replace(THIS_DIR, '/')
if self.venv
else 'the current environment'
)
if 'cache/uv/builds' in venv_path:
venv_path = 'an isolated .venv'
print(
Expand Down