[Distutils] easy_install adds bad interpreter shebang to installed scripts
Phillip J. Eby
pje at telecommunity.com
Thu Dec 18 18:23:43 CET 2008
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.
More information about the Distutils-SIG