setup.py 965 B

12345678910111213141516171819202122232425262728
  1. import subprocess
  2. import sys
  3. import setup_util
  4. import os
  5. def start(args, logfile, errfile):
  6. if os.name == 'nt':
  7. return 1
  8. # build
  9. subprocess.check_call("rm -rf bin obj", shell=True, cwd="evhttp-sharp", stdout=logfile, stderr=errfile)
  10. subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd="evhttp-sharp/src", stdout=logfile, stderr=errfile)
  11. os.environ['MONO_GC_PARAMS']="nursery-size=64m"
  12. subprocess.Popen("mono -O=all $TROOT/src/bin/Release/EvHttpSharpBenchmark.exe 127.0.0.1 8085 " + str(args.max_threads), shell=True, cwd="evhttp-sharp", stdout=logfile, stderr=errfile)
  13. def stop(logfile, errfile):
  14. if os.name == 'nt':
  15. return 0
  16. # stop mono
  17. p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
  18. out, err = p.communicate()
  19. for line in out.splitlines():
  20. if 'mono' in line and not 'run-ci' in line and not 'run-tests' in line:
  21. pid = int(line.split(None, 2)[1])
  22. os.kill(pid, 15)
  23. return 0