setup.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 clean", shell=True, cwd="treefrog")
  18. subprocess.check_call("make -j8", shell=True, cwd="treefrog")
  19. subprocess.check_call("rm -f log/*.log", shell=True, cwd="treefrog")
  20. subprocess.check_call("treefrog -d " + home + "/FrameworkBenchmarks/treefrog", shell=True)
  21. return 0
  22. except subprocess.CalledProcessError:
  23. return 1
  24. ##############
  25. # stop()
  26. ##############
  27. def stop():
  28. try:
  29. subprocess.call("treefrog -k abort " + home + "/FrameworkBenchmarks/treefrog", shell=True)
  30. return 0
  31. except subprocess.CalledProcessError:
  32. return 1