Skip to content

Commit a83bc13

Browse files
enaplesScuttoZ
authored andcommitted
tests: fix test_shebang_install
The change allows `uv run --script` shebangs through to the shebang installer, while still rejecting plain `bin/python`, `env python`, and project-mode uv run (without --script) shebangs that need a separate installer to manage dependencies.
1 parent ddaa4fa commit a83bc13

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tools/reckless

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,9 +1151,14 @@ def check_for_shebang(source: InstInfo) -> bool:
11511151
if entrypoint_file.split('\n')[0].startswith('#!'):
11521152
# Calling the python interpreter will not manage dependencies.
11531153
# Leave this to another python installer.
1154-
for interpreter in ['bin/python', 'env python', 'uv run']:
1155-
if interpreter in entrypoint_file.split('\n')[0]:
1154+
# Exception: 'uv run --script' uses PEP 723 inline metadata and
1155+
# is self-contained — let the shebang installer handle it.
1156+
shebang_line = entrypoint_file.split('\n')[0]
1157+
for interpreter in ['bin/python', 'env python']:
1158+
if interpreter in shebang_line:
11561159
return False
1160+
if 'uv run' in shebang_line and '--script' not in shebang_line:
1161+
return False
11571162
return True
11581163
return False
11591164

0 commit comments

Comments
 (0)