3 ms·
Nit: setuptools does not do this. Proper setuptools packages use the console_scripts entry point, which points to a function will never specify a shebang. A goo
by shadytrees 17y ago
Nit: setuptools does not do this. Proper setuptools packages use the console_scripts entry point, which points to a function will never specify a shebang. A good example is Paste Script [PS]. "paster" is linked the function "paste.script.command:run". When this is pip-installed into a virtualenv, you can `cat` the "paster" executable. It'll look like something like this [pr]; sure enough, the entire thing will have been automatically generated, taking into account the changed Python binary. Slag on setuptools all you want; PEAK got entry points nailed down perfectly.
[PS]: http://svn.pythonpaste.org/Paste/Script/trunk/setup.py http://svn.pythonpaste.org/Paste/Script/trunk/setup.py
[pr]: http://pastie.org/550423 http://pastie.org/550423
On the other hand, distutils has a `scripts=` keyword that points directly to a file, which then gets copied and pasted into the bin directory. Since the file has be word-for-word the script, the shebang is written directly. It depends on env, which should normally function; but, if it doesn't, as in the OP's case, there's no fallback. A good example of this is Mercurial [hg]. (Note: I actually haven't used raw distutils all that much, so there might be a work-around for this. A few fruitless minutes of Google Code Search hasn't turned up anything interesting.)
[hg]: http://selenic.com/repo/hg/file/47ce7a3a1fb0/hg http://selenic.com/repo/hg/file/47ce7a3a1fb0/hg
- jnoller 17y agoeasy_install, when installed with setuptools, hardcodes the shebang fwiw
- brodie 17y agohttp://docs.python.org/distutils/setupscript.html#installing-scripts http://docs.python.org/distutils/setupscript.html#installing... "The only clever feature is that if the first line of the script starts with #! and contains the word “python”, the Distutils will adjust the first line to refer to the current interpreter location. By default, it is replaced with the current interpreter location. The --executable (or -e) option will allow the interpreter path to be explicitly overridden."