Hi *,

I'm using Python 2.5 on Fedora Linux 9. If the path to the interpreter contains spaces and I install some eggs with scripts using easy_install, all installed scripts will have a non-functional shebang line like this:
#!"/home/foo bar/bin/python"

On Linux (and I think this is true for all Un*x flavors) you can not quote the shebang path and there is no way around this [1].

To make it more clear where the problem is I attached some kind of 'patch'. My idea was that quoting shebang paths seem to work on Windows (at least this was my impression from reading the changelogs) but on Linux there is no way to generate a working shebang line with an absolute path. Therefore it would help me if /usr/bin/env is queried.

Probably this will break for some people but currently the behavior is broken for everyone. With virtualenv you have to call activate (instead of calling the installed script directly) but then everything will work fine.

Do you consider this a kind of bug you might be inclined to fix?
fs

[1] http://groups.google.com/group/gnu.bash.bug/browse_thread/thread/861a98e53be305c3
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
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to