[Distutils] easy_install adds bad interpreter shebang to installed scripts

Ian Bicking ianb at colorstudy.com
Wed Dec 17 22:00:36 CET 2008


Phillip J. Eby wrote:
> At 06:15 PM 12/17/2008 +0100, Felix Schwarz wrote:
> 
>> Index: setuptools/command/easy_install.py
>> ===================================================================
>> --- setuptools/command/easy_install.py  (Revision 67824)
>> +++ setuptools/command/easy_install.py  (Arbeitskopie)
>> @@ -1418,8 +1418,12 @@
>>          if options: options = ' '+options
>>      if wininst:
>>          executable = "python.exe"
>> +    elif sys.platform=='win32':
>> +        executable = nt_quote_arg(executable)
>> +    elif ' ' in executable:
>> +        executable = '/usr/bin/env python'
>>      else:
>> -        executable = nt_quote_arg(executable)
>> +        executable = executable
>>      hdr = "#!%(executable)s%(options)s\n" % locals()
>>      if unicode(hdr,'ascii','ignore').encode('ascii') != hdr:
>>          # Non-ascii path to sys.executable, use -x to prevent warnings
> 
> I'm okay with the change in principle, but in practice, just dropping to 
> "/usr/bin/env python" isn't acceptable.  It should point env to the 
> specific sys.executable, just like the "fix_jython_executable()" 
> function does.

Does this work?

#!/usr/bin/env "/path/to/weird path/python"


-- 
Ian Bicking : ianb at colorstudy.com : http://blog.ianbicking.org


More information about the Distutils-SIG mailing list