[Distutils] easy_install adds bad interpreter shebang to installed scripts

Tres Seaver tseaver at palladion.com
Fri Dec 19 04:58:31 CET 2008

Hash: SHA1

Phillip J. Eby wrote:
> At 10:40 AM 12/18/2008 -0500, Jean-Paul Calderone wrote:
>> On Thu, 18 Dec 2008 16:20:28 +0100, Felix Schwarz 
>> <felix.schwarz at web.de> wrote:
>>> Phillip J. Eby schrieb:
>>>> At 10:17 PM 12/17/2008 +0100, Felix Schwarz wrote:
>>>>> Ian Bicking schrieb:
>>>>>> Does this work?
>>>>>> #!/usr/bin/env "/path/to/weird path/python"
>>>>> No (at least not for me).
>>>> Did you actually try that, as opposed to the version you showed 
>>>> before? There *is* a difference.
>>> Of course I tried. :-)
>>> I just tried again and it still does not work. However I noticed 
>>> that it works without any quoting for me too. Which I thought I tried before...
>>> So for me (using Fedora Linux with Python 2.5, nothing unusual) the 
>>> solution would be to add
>>> /usr/bin/env <unquoted path>
>>> Probably this is the way to go forward. Let's see if the behavior 
>>> is different for BSDs (I have neither a Mac nor any BSD-based 
>>> system available right now).
>> OS X results (note, ~/foo exists and is a directory):
> Hm.  So no matter what, it's not going to work on OS X; I guess that 
> means we could just go with the way that works on Linux.  ;-)
> It appears that OS X is doing what I'd expect a *BSD to - it's 
> splitting the #! line on spaces and feeding each one to env as a 
> separate argument -- quotes and all.
> The only other way to do this that I can think of would be to write 
> the file with a bilingual shell script header, such that it does an 
> exec of the appropriate Python on $0.  That would work on all 
> platforms, at the cost of incurring an extra exec -- but then, 
> /bin/env does that too.

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.

- --
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Distutils-SIG mailing list