"Fossies" - the Fresh Open Source Software Archive

Member "UNICORE-Client-7.4.1/plugins/org.apache.ant_1.10.3.v20180417-1627/bin/runant.py" (4 May 2018, 3385 Bytes) of package /windows/misc/UNICORE_Client-7.4.1-win32.win32.x86.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/python
    2 # Licensed to the Apache Software Foundation (ASF) under one or more
    3 #  contributor license agreements.  See the NOTICE file distributed with
    4 #  this work for additional information regarding copyright ownership.
    5 #  The ASF licenses this file to You under the Apache License, Version 2.0
    6 #  (the "License"); you may not use this file except in compliance with
    7 #  the License.  You may obtain a copy of the License at
    8 #
    9 #      http://www.apache.org/licenses/LICENSE-2.0
   10 #
   11 #  Unless required by applicable law or agreed to in writing, software
   12 #  distributed under the License is distributed on an "AS IS" BASIS,
   13 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14 #  See the License for the specific language governing permissions and
   15 #  limitations under the License.
   16 #
   17 
   18 """
   19 
   20  runant.py
   21 
   22     This script is a translation of the runant.pl
   23     It runs ant with/out arguments, it should be quite portable (thanks to
   24     the python os library)
   25     This script has been tested with Python2.0/Win2K
   26 
   27  Assumptions:
   28 
   29  - the "java" executable/script is on the command path
   30 """
   31 import os, os.path, string, sys
   32 
   33 # Change it to 1 to get extra debug information
   34 debug = 0
   35 
   36 #######################################################################
   37 
   38 # If ANT_HOME is not set default to script's parent directory
   39 if os.environ.has_key('ANT_HOME'):
   40     ANT_HOME = os.environ['ANT_HOME']
   41 else:
   42     ANT_HOME = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
   43 
   44 # set ANT_LIB location
   45 ANT_LIB = os.path.join(ANT_HOME, 'lib')
   46 
   47 # set JAVACMD (check variables JAVACMD and JAVA_HOME)
   48 JAVACMD = None
   49 if not os.environ.has_key('JAVACMD'):
   50     if os.environ.has_key('JAVA_HOME'):
   51         if not os.path.exists(os.environ['JAVA_HOME']):
   52             print "Warning: JAVA_HOME is not defined correctly."
   53         else:
   54             JAVA_HOME = os.environ['JAVA_HOME']
   55             while JAVA_HOME[0] == JAVA_HOME[-1] == "\"":
   56                 JAVA_HOME = JAVA_HOME[1:-1]
   57             JAVACMD = os.path.join(JAVA_HOME, 'bin', 'java')
   58     else:
   59         print "Warning: JAVA_HOME not set."
   60 else:
   61     JAVACMD = os.environ['JAVACMD']
   62 if not JAVACMD:
   63     JAVACMD = 'java'
   64 
   65 launcher_jar = os.path.join(ANT_LIB, 'ant-launcher.jar')
   66 if not os.path.exists(launcher_jar):
   67     print 'Warning: Unable to locate ant-launcher.jar. Expected to find it in %s' % \
   68         ANT_LIB
   69 
   70 # Build up standard classpath (LOCALCLASSPATH)
   71 LOCALCLASSPATH = launcher_jar
   72 if os.environ.has_key('LOCALCLASSPATH'):
   73     LOCALCLASSPATH += os.pathsep + os.environ['LOCALCLASSPATH']
   74 
   75 ANT_OPTS = ""
   76 if os.environ.has_key('ANT_OPTS'):
   77     ANT_OPTS = os.environ['ANT_OPTS']
   78 
   79 OPTS = ""
   80 if os.environ.has_key('JIKESPATH'):
   81     OPTS = '-Djikes.class.path=\"%s\"' % os.environ['JIKESPATH']
   82 
   83 ANT_ARGS = ""
   84 if os.environ.has_key('ANT_ARGS'):
   85     ANT_ARGS = os.environ['ANT_ARGS']
   86 
   87 CLASSPATH = ""
   88 if os.environ.has_key('CLASSPATH'):
   89     CLASSPATH = "-lib " + os.environ['CLASSPATH']
   90 
   91 while JAVACMD[0] == JAVACMD[-1] == "\"":
   92     JAVACMD = JAVACMD[1:-1]
   93 
   94 # Builds the commandline
   95 cmdline = ('"%s" %s -classpath %s -Dant.home=%s %s ' + \
   96     'org.apache.tools.ant.launch.Launcher %s %s %s') \
   97      % (JAVACMD, ANT_OPTS, LOCALCLASSPATH, ANT_HOME, OPTS, ANT_ARGS, \
   98         CLASSPATH, string.join(sys.argv[1:], ' '))
   99 
  100 if debug:
  101     print '\n%s\n\n' % (cmdline)
  102 sys.stdout.flush()
  103 
  104 # Run the biniou!
  105 os.system(cmdline)