On 3/8/2011 12:02 PM, Terry Reedy wrote:
On 3/7/2011 9:31 PM, Reliable Domains wrote:
The launcher need not be called "python.exe", and maybe it would be
better called #@launcher.exe (or similar, depending on its exact
function details).
I do not know that the '#@' part is about, but pygo would be short and
expressive.
If my proposal to make a line starting with #@ to be used instead of the
Unix #! (#@ could be on the first or second line, to allow
cross-platform scripts to use both, and Windows only scripts to not have
#!), then #@launcher.exe (and #@launcherw.exe I suppose) would reflect
the functionality of the launcher, which need not be tightly tied to
Python, if it uses a separate line. But the launcher should probably
not be the thing invoked from the command line, only implicitly when
running scripts by naming them as the first thing on the command line.
I'm of the opinion that attempting to parse a Unix #! line, and intuit
what would be the equivalent on Windows is unnecessarily complex and
error prone, and assumes that the variant systems are configured using
the same guidelines (which the Python community may espouse, but may not
be followed by all distributions, sysadmins, or users). That's why I
propose a different line for Windows... it is as simple as the
long-proven Unix #! line, but imposes no restrictions on or requirements
that there be a #! line; it has more flexibility in that it could invoke
different versions or provide different options on Unix and Windows if
necessary for some environments.
#!/usr/bin/env python2.6 -B
#@c:\python26\python2.6.exe
or
#!/usr/bin/python2.5
#@"C:\Program Files (x86)\IronPython 2.6 for .NET 4.0\ipy.exe"
Now that I've had this idea, one might want to create other "2nd
character" codes after the Unix #! line... one could have
#! Unix command processor
#@ Windows command processor
#$ OS/2 command processor
#% Alternate Windows command processor.
One could even port it to Unix:
#!/usr/bin/#@launcher
#@c:\python2.6\python.exe
#^/usr/bin/python2.5
#&/usr/bin/mono/IronPython2.6 for .NET 4.0/ipy.exe
# I made up the line above, having no knowledge of Mono, but I think
you get the idea
Choice of command line would be an environment variable, I suppose, that
the launcher would look at, or if none, then a system-specific default.
It would have to search forward in the file until it finds the
appropriate prefix or a line not starting with #, or starting with "# "
or "##", at which point it would give up.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com