[Distutils] easy_install adds bad interpreter shebang to installed scripts

Phillip J. Eby pje at telecommunity.com
Sat Dec 20 02:16:03 CET 2008


At 01:33 AM 12/19/2008 -0600, Ian Bicking wrote:
>Tres Seaver wrote:
>>I would way rather see that kind of solution than using 'env':  scripts
>>installed by easy_install should *not* use whatever python happens to be
>>found at the moment on PATH.
>
>I agree that's necessary, but I don't think anyone has been 
>proposing that (well, except the initial proposal).  I'm guessing 
>the script in this case could look like:
>
>#!/bin/sh
>exec "path/to/python" -c "everything that would normally be in the 
>body of the script"

Actually, I was thinking more like:

#!/bin/sh
# standard easy_install comment lines here
""":"
exec '/path/to/python' "$0" "$@"
"""
# rest of the code here

The idea being to preserve the inspectable info that easy_install 
puts in the first few lines of script comments.  And of course, to 
properly pass through sys.argv, etc.  The path to sys.executable also 
needs to be properly escaped by the code writing the script.



More information about the Distutils-SIG mailing list