setup.py 1.1 KB

12345678910111213141516171819202122232425
  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", "root-directory=\"%s" % args.fwroot)
  8. try:
  9. # This was reporting an error because it already exists... not sure.
  10. #subprocess.call("mkdir classes", shell=True, cwd="gemini/Docroot/WEB-INF", stderr=errfile, stdout=logfile)
  11. subprocess.check_call("ant compile", shell=True, cwd="gemini", stderr=errfile, stdout=logfile)
  12. subprocess.check_call("$RESIN_HOME/bin/resinctl -conf $FWROOT/gemini/Docroot/WEB-INF/resin.xml start", shell=True, stderr=errfile, stdout=logfile)
  13. return 0
  14. except subprocess.CalledProcessError:
  15. return 1
  16. def stop(logfile, errfile):
  17. try:
  18. subprocess.check_call("$RESIN_HOME/bin/resinctl shutdown", shell=True, stderr=errfile, stdout=logfile)
  19. return 0
  20. except subprocess.CalledProcessError:
  21. return 1