setup.py 1.0 KB

1234567891011121314151617181920212223
  1. import subprocess
  2. import sys
  3. import setup_util
  4. from os.path import expanduser
  5. def start(args, logfile, errfile):
  6. setup_util.replace_text("gemini/Docroot/WEB-INF/GeminiHello.conf", "db.ConnectString = .*:3306", "db.ConnectString = " + args.database_host + ":3306")
  7. setup_util.replace_text("gemini/Docroot/WEB-INF/resin.xml", "root-directory=\".*\/FrameworkBenchmarks/gemini", "root-directory=\"%s" % args.troot)
  8. try:
  9. subprocess.call("mkdir -p classes", shell=True, cwd="gemini/Docroot/WEB-INF", stderr=errfile, stdout=logfile)
  10. subprocess.check_call("ant compile", shell=True, cwd="gemini", stderr=errfile, stdout=logfile)
  11. subprocess.check_call("$RESIN_HOME/bin/resinctl -conf $TROOT/Docroot/WEB-INF/resin.xml start", shell=True, stderr=errfile, stdout=logfile)
  12. return 0
  13. except subprocess.CalledProcessError:
  14. return 1
  15. def stop(logfile, errfile):
  16. try:
  17. subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True, stderr=errfile, stdout=logfile)
  18. return 0
  19. except subprocess.CalledProcessError:
  20. return 1