setup.py 976 B

123456789101112131415161718192021222324252627282930313233343536
  1. import subprocess
  2. import sys
  3. import setup_util
  4. from os.path import expanduser
  5. home = expanduser("~")
  6. ##############
  7. # start(args)
  8. ##############
  9. def start(args):
  10. setup_util.replace_text("treefrog/config/database.ini", "HostName=.*", "HostName=" + args.database_host)
  11. # 1. Generate Makefile
  12. # 2. Compile applicaton
  13. # 3. Clean log files
  14. # 4. Start TreeFrog
  15. try:
  16. subprocess.check_call("qmake -r CONFIG+=release", shell=True, cwd="treefrog")
  17. subprocess.check_call("make", shell=True, cwd="treefrog")
  18. subprocess.check_call("rm -f ./*.log", shell=True, cwd="treefrog/log")
  19. subprocess.check_call("treefrog -d " + home + "/FrameworkBenchmarks/treefrog", shell=True)
  20. return 0
  21. except subprocess.CalledProcessError:
  22. return 1
  23. ##############
  24. # stop()
  25. ##############
  26. def stop():
  27. try:
  28. subprocess.call("treefrog -k abort " + home + "/FrameworkBenchmarks/treefrog", shell=True)
  29. return 0
  30. except subprocess.CalledProcessError:
  31. return 1