SF.net SVN: jython:[7143] trunk/jython/src/shell/jython.bat

[email protected] Sun, 10 Oct 2010 11:36:06 +0000
Newsgroups gmane.comp.lang.jython.cvs
Message-ID <[email protected]>
Revision: 7143
          http://jython.svn.sourceforge.net/jython/?rev=7143&view=rev
Author:   otmarhumbel
Date:     2010-10-10 11:36:05 +0000 (Sun, 10 Oct 2010)

Log Message:
-----------
more reliable handling of JAVA_HOME, JYTHON_HOME and JYTHON_OPTS

Modified Paths:
--------------
    trunk/jython/src/shell/jython.bat

Modified: trunk/jython/src/shell/jython.bat
===================================================================
--- trunk/jython/src/shell/jython.bat	2010-10-10 10:29:15 UTC (rev 7142)
+++ trunk/jython/src/shell/jython.bat	2010-10-10 11:36:05 UTC (rev 7143)
@@ -25,28 +25,11 @@
 rem ----- Verify and set required environment variables -----------------------
 
 set _JAVA_CMD=java
-rem remove surrounding quotes from java home, to be able to safely empty-test it
-set _TRIMMED_JAVA_HOME=%JAVA_HOME%
-for /f "usebackq tokens=*" %%a in ('%_TRIMMED_JAVA_HOME%') do set _TRIMMED_JAVA_HOME=%%~a
-if not "%_TRIMMED_JAVA_HOME%"=="" (
-   set _JAVA_CMD="%JAVA_HOME:"=%\bin\java"
-)
+if defined JAVA_HOME set _JAVA_CMD="%JAVA_HOME:"=%\bin\java"
+if defined JYTHON_OPTS set _JYTHON_OPTS="%JYTHON_OPTS:"=%" 
+if defined JYTHON_HOME set _JYTHON_HOME="%JYTHON_HOME:"=%"
+if defined _JYTHON_HOME goto gotHome
 
-rem remove surrounding quotes from jython opts, to be able to safely empty-test it
-set _TRIMMED_JYTHON_OPTS=%JYTHON_OPTS%
-for /f "usebackq tokens=*" %%a in ('%_TRIMMED_JYTHON_OPTS%') do set _TRIMMED_JYTHON_OPTS=%%~a
-if not "%_TRIMMED_JYTHON_OPTS%"=="" (
-   set _JYTHON_OPTS="%_TRIMMED_JYTHON_OPTS%"
-)
-
-rem remove surrounding quotes from jython home, to be able to safely empty-test it
-set _TRIMMED_JYTHON_HOME=%JYTHON_HOME%
-for /f "usebackq tokens=*" %%a in ('%_TRIMMED_JYTHON_HOME%') do set _TRIMMED_JYTHON_HOME=%%~a
-if not "%_TRIMMED_JYTHON_HOME%"=="" (
-   set _JYTHON_HOME="%_TRIMMED_JYTHON_HOME%"
-   goto gotHome
-)
-
 rem try to dynamically determine jython home
 rem (this script typically resides in jython home, or in the /bin subdirectory)
 pushd "%~dp0%"
@@ -128,10 +111,10 @@
 if ["%_CMP%"] == ["--"] goto argsDone
 
 if ["%_CMP%"] == ["--jdb"] (
-   if "%_TRIMMED_JAVA_HOME%"=="" (
-      set _JAVA_CMD=jdb
-   ) else (
+   if defined JAVA_HOME (
       set _JAVA_CMD="%JAVA_HOME:"=%\bin\jdb"
+   ) else (
+      set _JAVA_CMD=jdb
    )
    goto :nextArg
 )
@@ -216,9 +199,6 @@
 set _JYTHON_OPTS=
 set _JYTHON_ARGS=
 set _PRINT=
-set _TRIMMED_JAVA_HOME=
-set _TRIMMED_JYTHON_HOME=
-set _TRIMMED_JYTHON_OPTS=
 goto finish
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb