Commit b2ad694d authored by Reinout van Rees's avatar Reinout van Rees

Added safeguard for deranged one-line scripts.

Should never ever happen, of course, but somewhere in the universe exists a
distutils script with just the `#!bin/python` line... Added a len() to guard
against that.
parent 52486934
...@@ -1050,7 +1050,7 @@ def _distutils_script(path, dest, script_content, initialization, rsetup): ...@@ -1050,7 +1050,7 @@ def _distutils_script(path, dest, script_content, initialization, rsetup):
return [] return []
source_encoding_line = '' source_encoding_line = ''
original_content = ''.join(lines[1:]) original_content = ''.join(lines[1:])
if is_source_encoding_line(lines[1]): if (len(lines) > 1) and is_source_encoding_line(lines[1]):
# The second line contains a source encoding line. Copy it verbatim. # The second line contains a source encoding line. Copy it verbatim.
source_encoding_line = lines[1].rstrip() source_encoding_line = lines[1].rstrip()
original_content = ''.join(lines[2:]) original_content = ''.join(lines[2:])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment