Issue1661420

classification
Title: Simplifying argument processing in jython.bat
Type: Severity: normal
Components: Installer Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: fwierzbicki, hsk0, pekka.klarck
Priority: normal Keywords:

Created on 2007-02-16.11:05:47 by pekka.klarck, last changed 2009-03-14.01:17:08 by fwierzbicki.

Messages
msg1468 (view) Author: Pekka Klärck (pekka.klarck) Date: 2007-02-16.11:05:47
jython.bat script has a bit ugly loop (well, batch scripts are always ugly) for processing arguments given to it. The script I have has following contents.

"""
set ARGS=

:loop
if [%1] == [] goto end
    set ARGS=%ARGS% %1
    shift
    goto loop
:end

"C:\Program Files\Java\jre1.5.0_10\bin\java.exe" -Dpython.home="C:\jython2.2b1" -classpath "C:\jython2.2b1\jython.jar;%CLASSPATH%" org.python.util.jython %ARGS%
"""

At least on Win XP all arguments given to a batch script are available in special variable %* (similarly as in bash they are in $*). The above code could thus be simplified significantly into following.

"""
"C:\Program Files\Java\jre1.5.0_10\bin\java.exe" -Dpython.home="C:\jython2.2b1" -classpath "C:\jython2.2b1\jython.jar;%CLASSPATH%" org.python.util.jython %*
"""

People playing with Jython a bit more (e.g. wanting to update Java it uses) are likely to investigate jython.bat script at some point and making it simpler would thus be nice.

Of course it should first be tested does %* work in other Windows versions than XP. I assume it works on NT based versions but I'm worried about 95/98/ME series. Installer could of course have different versions of jython.bat for different Windows versions but that may be an overkill.

msg1469 (view) Author: Pekka Klärck (pekka.klarck) Date: 2007-02-16.11:13:37
Similar jython.bat script is also shown in Jython developer guide [1]. At least that could probably be changed because it's very unlikely that anyone is developing Jython on 9x series Windows.

[1] http://wiki.python.org/jython/JythonDeveloperGuide
msg1470 (view) Author: howard kapustein (hsk0) Date: 2007-03-01.05:26:11
FYI %* is supported in W2K and NT as well as XP (and newer).

From http://www.robvanderwoude.com/index.html

%* will return all command line parameters following %0; keep in mind that Windows NT 4 will insert an extra space before %*, whereas 2000 and XP will remove all leading spaces from %*

and the leading space character on NT4 isn't a problem in this case.


At this point in time is Win9x support relevant anymore?
How many are still in use _and_ will add Jython?
If it's a concern, as mentioned, the installer can emit different bits for Win9x vs. NT.

I'll gladly submit a patch either way, just call it which way you want to go.
msg4278 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2009-03-14.01:17:08
jython.bat has been completely rewritten, so closing this.
History
Date User Action Args
2009-03-14 01:17:08fwierzbickisetstatus: open -> closed
resolution: fixed
messages: + msg4278
nosy: + fwierzbicki
2007-02-16 11:05:47pekka.klarckcreate