[Distutils] [issue27] [PATCH] Fix shebang lines for Jython on POSIX

Philip Jenvey setuptools at bugs.python.org
Wed Jul 16 02:33:40 CEST 2008

New submission from Philip Jenvey <pjenvey at underboss.org>:

Jython's sys.executable is a shell script on POSIX (and .bat on Windows) and 
thus can't be used as a shebang line interpreter.

The following patch works around this by calling sys.executable via /usr/bin/env 
in shebang lines on platforms where sys.platform.startswith('java') and 
sys.executable's MAGIC is '#!'.

Jython on Windows is a separate issue -- Jython probably has to ship a .exe to 
solve the problem there. This fix doesn't apply to Windows because 
sys.executable's MAGIC is not '#!' there.

Marking as a higher priority because installed scripts on Jython aren't 
executable without this fix

Original distutils-sig discussion: http://www.nabble.com/Shebang-lines-on-

files: jython-shebang-fix_r61342.diff
messages: 60
nosy: pjenvey
priority: critical
status: unread
title: [PATCH] Fix shebang lines for Jython on POSIX
Added file: http://bugs.python.org/setuptools/file10/jython-shebang-fix_r61342.diff

Setuptools tracker <setuptools at bugs.python.org>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jython-shebang-fix_r61342.diff
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20080716/8a958d14/attachment.txt>

More information about the Distutils-SIG mailing list