# HG changeset patch # User melissacline # Date 1409773069 14400 # Node ID 0676a227dbc6f22c039384b20b308ef91a568c0c Uploaded diff -r 000000000000 -r 0676a227dbc6 startXena.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/startXena.py Wed Sep 03 15:37:49 2014 -0400 @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +import argparse +import os +import subprocess +import sys + +def stop_err(msg, fp, error_level=1): + """Print error message to stdout and quit with given error level.""" + #sys.stderr.write("%s\n" % msg) + fp.write("%s\n" % msg) + fp.write("error code %d\n" % error_level) + sys.exit(error_level) + + +def run(cmd, fp): + #Avoid using shell=True when we call subprocess to ensure if the Python + #script is killed, so too is the child process. + try: + child = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, shell=True) + except Exception, err: + stop_err("Error invoking command:\n%s\n\n%s\n" % (" ".join(cmd), err)) + #Use .communicate as can get deadlocks with .wait(), + stdout, stderr = child.communicate() + return_code = child.returncode + if return_code: + if stderr and stdout: + stop_err("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, err, stdout, stderr), fp) + else: + stop_err("Return code %i from command:\n%s\n%s" % (return_code, err, stderr), fp) + + + +def main(): + jarPath = os.getenv("JAVA_JAR_PATH", "~") + xenaBaseDir = os.getenv("XENA_BASE_DIR", "~") + xenaJarPath = os.path.join(jarPath, "xena.jar") + xenaBaseDir = os.getenv("XENA_BASE_DIR", "~") + cmdline = "java -jar %s -r %s/xena/files -d %s/xena/db -t %s/xena/tmp" % (xenaJarPath, xenaBaseDir, xenaBaseDir, xenaBaseDir) + for ii in range(1,len(sys.argv)): + cmdline = "%s %s" % (cmdline, sys.argv[ii]) + print "executing", cmdline + fp = open("/inside/home/cline/tmp/xena.out", "w") + fp.write("jar path (not paht) %s\n" % (jarPath)) + fp.write("xena base dir %s\n" % (xenaBaseDir)) + fp.write(cmdline) + run(cmdline, fp) + fp.close() + +if __name__ == '__main__': + main( ) + diff -r 000000000000 -r 0676a227dbc6 tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Wed Sep 03 15:37:49 2014 -0400 @@ -0,0 +1,19 @@ + + + + + + + ${REPOSITORY_INSTALL_DIR}/xena/xena.jar + ${INSTALL_DIR} + + + $INSTALL_DIR + + + $INSTALL_DIR/xena + + + + + diff -r 000000000000 -r 0676a227dbc6 xena.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xena.xml Wed Sep 03 15:37:49 2014 -0400 @@ -0,0 +1,15 @@ + + XENA VM + + installXena + + + startXena.py -H 0.0.0.0 -p 1236 & + + + Press the Execute button to start the Xena VM. + + + + +