setup.py 733 B

123456789101112131415161718192021
  1. import subprocess
  2. import sys
  3. import os
  4. import setup_util
  5. import time
  6. def start(args):
  7. setup_util.replace_text("revel/src/benchmark/conf/app.conf", "tcp\(.*:3306\)", "tcp(" + args.database_host + ":3306)")
  8. subprocess.call("go get github.com/robfig/revel/cmd", shell=True, cwd="revel")
  9. subprocess.call("go build -o bin/revel github.com/robfig/revel/cmd", shell=True, cwd="revel")
  10. subprocess.Popen("bin/revel run benchmark prod".rsplit(" "), cwd="revel")
  11. return 0
  12. def stop():
  13. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  14. out, err = p.communicate()
  15. for line in out.splitlines():
  16. if 'revel' in line and 'run-tests' not in line:
  17. pid = int(line.split(None, 2)[1])
  18. os.kill(pid, 9)
  19. return 0