1.1 --- a/tools/JavaServlet/webstack_java_build.py Thu Sep 27 17:48:43 2007 +0000
1.2 +++ b/tools/JavaServlet/webstack_java_build.py Thu Sep 27 22:32:20 2007 +0000
1.3 @@ -75,13 +75,14 @@
1.4 def get_appname(handler):
1.5 return os.path.split(os.path.splitext(handler)[0])[1]
1.6
1.7 -def make_app(handler, appdir, webstack_home, jython_cachedir, web_xml_template_name):
1.8 +def make_app(handler, webstack_home, jython_cachedir, web_xml_template_name, packages):
1.9
1.10 """
1.11 - Make the application directory from the given 'handler', application
1.12 - directory 'appdir', the 'webstack_home' where the WebStack package can be
1.13 - found, the 'jython_cachedir' where Jython classes are cached, and the
1.14 - deployment descriptor with the given 'web_xml_template_name'.
1.15 + Make the application directory from the given 'handler', the 'webstack_home'
1.16 + where the WebStack package can be found, the 'jython_cachedir' where Jython
1.17 + classes are cached, the deployment descriptor with the given
1.18 + 'web_xml_template_name', and the specified 'packages' (locations of
1.19 + application packages).
1.20 """
1.21
1.22 appname = get_appname(handler)
1.23 @@ -108,9 +109,10 @@
1.24 copy_directory(os.path.join(webstack_home, "WebStack"),
1.25 os.path.join(appname, "WEB-INF", "jython"))
1.26
1.27 - # Copy the application itself.
1.28 + # Copy the application packages.
1.29
1.30 - copy_directory(appdir, os.path.join(appname, "WEB-INF", "jython"))
1.31 + for appdir in packages:
1.32 + copy_directory(appdir, os.path.join(appname, "WEB-INF", "jython"))
1.33
1.34 # Copy the handler.
1.35
1.36 @@ -148,30 +150,53 @@
1.37 import sys
1.38 if len(sys.argv) < 5:
1.39 print "Please specify..."
1.40 - print " * The location of the application handler."
1.41 - print " eg. .../WebStack-x.y/examples/JavaServlet/SimpleApp.py"
1.42 - print " * The location of the application."
1.43 - print " eg. .../WebStack-x.y/examples/Common/Simple"
1.44 - print " * The location of the WebStack package distribution or where"
1.45 - print " WebStack documentation and extras have been installed."
1.46 - print " eg. .../WebStack-x.y"
1.47 - print " eg. /usr/share/doc/python2.4-webstack"
1.48 - print " * The location of the Jython cache directory."
1.49 - print " eg. /home/paulb/.jython-cache"
1.50 - print " * The name of the deployment descriptor template."
1.51 - print " eg. web.xml"
1.52 - print "You can also specify some additional libraries for the application..."
1.53 - print " eg. $CATALINA_HOME/common/lib/activation.jar"
1.54 - print " $CATALINA_HOME/common/lib/mail.jar"
1.55 + print
1.56 + print "The location of the application handler. For example:"
1.57 + print
1.58 + print " .../WebStack-x.y/examples/JavaServlet/SimpleApp.py"
1.59 + print
1.60 + print "The location of the WebStack package distribution or where WebStack"
1.61 + print "documentation and extras have been installed. For example:"
1.62 + print
1.63 + print " .../WebStack-x.y"
1.64 + print " /usr/share/doc/python2.4-webstack"
1.65 + print
1.66 + print "The location of the Jython cache directory. For example:"
1.67 + print
1.68 + print " /home/paulb/.jython-cache"
1.69 + print
1.70 + print "The name of the deployment descriptor template. For example:"
1.71 + print
1.72 + print " web.xml"
1.73 + print
1.74 + print "The location of the application packages. For example:"
1.75 + print
1.76 + print " .../WebStack-x.y/examples/Common/Simple"
1.77 + print
1.78 + print "You can also specify some additional libraries for the application"
1.79 + print "after a special '--libraries' marker. For example:"
1.80 + print
1.81 + print " $CATALINA_HOME/common/lib/activation.jar"
1.82 + print " $CATALINA_HOME/common/lib/mail.jar"
1.83 sys.exit(1)
1.84
1.85 + handler, webstack_home, jython_cachedir, web_xml = sys.argv[1:5]
1.86 +
1.87 + try:
1.88 + libraries_index = sys.argv.index("--libraries")
1.89 + packages = sys.argv[5:libraries_index]
1.90 + libraries = sys.argv[libraries_index+1:]
1.91 + except ValueError:
1.92 + packages = sys.argv[5:]
1.93 + libraries = []
1.94 +
1.95 print "Making application directory..."
1.96 - make_app(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
1.97 + make_app(handler, webstack_home, jython_cachedir, web_xml, packages)
1.98
1.99 - if len(sys.argv) > 6:
1.100 + if libraries:
1.101 print "Copying additional libraries..."
1.102 appname = get_appname(sys.argv[1])
1.103 - for library in sys.argv[6:]:
1.104 + for library in libraries:
1.105 library_dir, library_name = os.path.split(library)
1.106 library_dest = os.path.join(appname, "WEB-INF", "lib", library_name)
1.107 copy_file(library, library_dest)