Issue #267 new

Incorrect shebang line when python executable path contains \"

grahamdennis
created an issue

Problem: When using a python interpreter located in a path which contains the literal string \", easy_install overquotes the path. Problem experienced on Mac OS X 10.7.2 with python 2.7.1 and distribute 0.6.19. I expect the bug to occur on all Unix flavours.

Steps to reproduce: {{{ mkdir test\\" # produces a directory test\" python virtualenv.py --distribute test\\" # To create a virtualenv installation of python in test\" ./test\\"/bin/easy_install }}} This last step fails with error: {{{ -bash: ./test\"/bin/easy_install: /Users/graham/Developer/xmds-mac/BuildScripts/test\\"/bin/python: bad interpreter: No such file or directory }}} because the shebang line for bin/easy_install is {{{

!/Users/graham/Developer/xmds-mac/BuildScripts/test\\"/bin/python

}}}

while it should read {{{

!/Users/graham/Developer/xmds-mac/BuildScripts/test\"/bin/python

}}}

The error appears to be in {{{get_script_header()}}} in {{{setuptools/command/easy_install.py}}}. Specifically the lines:

{{{ if wininst: executable = "python.exe" else: executable = nt_quote_arg(executable) }}}

The variable {{{wininst}}} appears to be referring to a windows installation, so I don't understand why if it is false that {{{nt_quote_arg}}} is called on the executable path. {{{nq_quote_arg}}} is documented as quoting a command line argument according to Windows parsing rules.