setup.py 839 B

12345678910111213141516171819202122232425262728
  1. import subprocess
  2. import sys
  3. import setup_util
  4. import os
  5. root = os.getcwd() + "/evhttp-sharp"
  6. app = root + "/src"
  7. def start(args, logfile, errfile):
  8. if os.name == 'nt':
  9. return 1
  10. try:
  11. # build
  12. subprocess.check_call("rm -rf bin obj", shell=True, cwd=app, stdout=logfile, stderr=errfile)
  13. subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd=app, stdout=logfile, stderr=errfile)
  14. os.environ['MONO_GC_PARAMS']="nursery-size=64m"
  15. subprocess.Popen("mono -O=all bin/Release/EvHttpSharpBenchmark.exe 127.0.0.1 8085 " + str(args.max_threads) + " &", shell=True, cwd=app, stdout=logfile, stderr=errfile)
  16. return 0
  17. except subprocess.CalledProcessError:
  18. return 1
  19. def stop(logfile, errfile):
  20. if os.name == 'nt':
  21. return 0
  22. subprocess.check_call("pkill -9 mono", shell=True)
  23. return 0