[Distutils] Shebang lines on Jython

Philip Jenvey pjenvey at underboss.org
Wed Apr 16 23:40:47 CEST 2008


On Apr 16, 2008, at 11:39 AM, Phillip J. Eby wrote:
> Make a jython.exe that either runs the batch file, or does the same
> things itself.  As you can see from launcher.c, it's not that hard to
> make one, and trivial to build it with the cygwin/MinGW tools.  And
> then make jython's sys.executable on Windows be that Jython.exe.
>
> You can pretty much do the same thing for other platforms.  Yes, I
> know it means you'll have to compile something, but it beats the
> living tar out of trying to handle parameters and options in shebang
> lines.  Have a look at the chart on this page:
>
>    http://www.in-ulm.de/~mascheck/various/shebang/
>
> for some horror stories.

Yea I'm trying not to worry about the arg parsing evilness on posix.  
Since it's not too common to pass an argument to python in the  
shebang line anyway, without going out of our way to support that we  
could get away with #!/usr/bin/env /opt/local/bin/jython

Your point definitely applies to our Windows situation, though,  
thanks. Maybe we could ship a windows .exe and just keep posix the  
way it is for now. In the future maybe we could have our installer  
attempt to compile a runner on posix if a C compiler is installed,  
otherwise fallback to the .sh script, but I'm not going to deal with  
that at the moment.

With that I'll have to create a patch to setuptools to use #!/usr/bin/ 
env if on jython and open(sys.executable).read(2) == '#!' and not  
sys.executable.endswith('.bat') (or some kind of windows check).

--
Philip Jenvey




More information about the Distutils-SIG mailing list