@@ -87,17 +87,20 @@ def _parse_shebang(cmd, line):
8787 if cmd .shebang_can_run_anything or cmd .shebang_can_run_anything_silently :
8888 i = _find_on_path (cmd , full_cmd )
8989 if not cmd .shebang_can_run_anything_silently :
90- LOGGER .warn ("A shebang '%s' was found, but could not be matched "
91- "to an installed runtime." , full_cmd )
92- LOGGER .warn ("Arbitrary command was found on PATH instead. Configure "
93- "'shebang_can_run_anything' to disable this." )
90+ LOGGER .warn ("A shebang '%s' was found but could not be matched "
91+ "to an installed runtime, so it will be treated as "
92+ "an arbitrary command." , full_cmd )
93+ LOGGER .warn ("To prevent execution of programs that are not "
94+ "Python runtimes, set 'shebang_can_run_anything' to "
95+ "'false' in your configuration file." )
9496 return i
9597
9698 else :
9799 LOGGER .warn ("A shebang '%s' was found, but could not be matched "
98100 "to an installed runtime." , full_cmd )
99- LOGGER .warn ("Arbitrary command execution is disabled. Reconfigure "
100- "'shebang_can_run_anything' to enable it. "
101+ LOGGER .warn ("Arbitrary command execution is disabled. Configure "
102+ "'shebang_can_run_anything' to 'true' in your "
103+ "configuration file to enable it. "
101104 "Launching with default runtime." )
102105 raise LookupError
103106
@@ -114,16 +117,19 @@ def _parse_shebang(cmd, line):
114117 pass
115118 if cmd .shebang_can_run_anything or cmd .shebang_can_run_anything_silently :
116119 if not cmd .shebang_can_run_anything_silently :
117- LOGGER .warn ("A shebang '%s' was found, but does not match any "
118- "supported template (e.g. '/usr/bin/python')." , full_cmd )
119- LOGGER .warn ("Using the shebang as an arbitrary command instead. "
120- "Configure 'shebang_can_run_anything' to disable this." )
120+ LOGGER .warn ("A shebang '%s' was found but does not match any "
121+ "supported template (e.g. '/usr/bin/python'), so it "
122+ "will be treated as an arbitrary command." , full_cmd )
123+ LOGGER .warn ("To prevent execution of programs that are not "
124+ "Python runtimes, set 'shebang_can_run_anything' to "
125+ "'false' in your configuration file." )
121126 return _find_on_path (cmd , full_cmd )
122127 else :
123128 LOGGER .warn ("A shebang '%s' was found, but could not be matched "
124129 "to an installed runtime." , full_cmd )
125- LOGGER .warn ("Arbitrary command execution is disabled. Reconfigure "
126- "'shebang_can_run_anything' to enable it. "
130+ LOGGER .warn ("Arbitrary command execution is disabled. Change "
131+ "'shebang_can_run_anything' to 'true' in your "
132+ "configuration file to enable it. "
127133 "Launching with default runtime." )
128134 raise LookupError
129135
@@ -153,7 +159,7 @@ def _read_script(cmd, script, encoding):
153159 # This involves finding '# /// script' followed by
154160 # a line with '# requires-python = <spec>'.
155161 # That spec needs to be processed as a version constraint, which
156- # is currently entirely unsupported .
162+ # cmd.get_install_to_run() can handle .
157163 raise LookupError (script )
158164
159165
0 commit comments