mirror of https://github.com/pypa/pip
Merge c7feaf743b
into 2a0acb595c
This commit is contained in:
commit
ac10f407a3
|
@ -0,0 +1 @@
|
||||||
|
Script shebang "#!python" replacement now preserves all arguments after the first space (e.g. "#!python -i")
|
|
@ -103,7 +103,9 @@ def fix_script(path: str) -> bool:
|
||||||
if not firstline.startswith(b"#!python"):
|
if not firstline.startswith(b"#!python"):
|
||||||
return False
|
return False
|
||||||
exename = sys.executable.encode(sys.getfilesystemencoding())
|
exename = sys.executable.encode(sys.getfilesystemencoding())
|
||||||
firstline = b"#!" + exename + os.linesep.encode("ascii")
|
parts = firstline.split(maxsplit=1)
|
||||||
|
postinterp = b" " + parts[1].rstrip() if len(parts) > 1 else b""
|
||||||
|
firstline = b"#!" + exename + postinterp + os.linesep.encode("ascii")
|
||||||
rest = script.read()
|
rest = script.read()
|
||||||
with open(path, "wb") as script:
|
with open(path, "wb") as script:
|
||||||
script.write(firstline)
|
script.write(firstline)
|
||||||
|
|
Loading…
Reference in New Issue