Browse Source

Fix bottle test

Hamilton Turner 11 years ago
parent
commit
cb8e88a5d5
4 changed files with 28 additions and 21 deletions
  1. 16 0
      bottle/bash_profile.sh
  2. 4 7
      bottle/setup.py
  3. 4 6
      bottle/setup_py3.py
  4. 4 8
      bottle/setup_pypy.py

+ 16 - 0
bottle/bash_profile.sh

@@ -0,0 +1,16 @@
+
+export PY2_ROOT=$IROOT/py2
+export PY2=$PY2_ROOT/bin/python
+export PY2_PIP=$PY2_ROOT/bin/pip
+export PY2_GUNICORN=$PY2_ROOT/bin/gunicorn
+
+export PYPY_ROOT=$IROOT/pypy
+export PYPY=$PYPY_ROOT/bin/python
+export PYPY_PIP=$PYPY_ROOT/bin/pip
+export PYPY_GUNICORN=$PYPY_ROOT/bin/gunicorn
+
+export PY3_ROOT=$IROOT/py3
+export PY3=$PY3_ROOT/bin/python
+export PY3_PIP=$PY3_ROOT/bin/pip
+export PY3_GUNICORN=$PY3_ROOT/bin/gunicorn
+

+ 4 - 7
bottle/setup.py

@@ -1,19 +1,13 @@
 import subprocess
 import subprocess
 import os
 import os
 
 
-BIN = os.path.expanduser('~/FrameworkBenchmarks/installs/py2/bin')
 
 
 proc = None
 proc = None
 
 
 
 
 def start(args, logfile, errfile):
 def start(args, logfile, errfile):
     global proc
     global proc
-    proc = subprocess.Popen(
-        [BIN + "/gunicorn",
-         "-c", "gunicorn_conf.py",
-         "-e", "DBHOSTNAME=" + args.database_host,
-         "app:app"],
-        cwd="bottle", stderr=errfile, stdout=logfile)
+    proc = subprocess.Popen( "$PY2_GUNICORN -c gunicorn_conf.py -e DBHOSTNAME=%s app:app" % args.database_host, cwd="bottle", shell=True, stderr=errfile, stdout=logfile)
     return 0
     return 0
 
 
 
 
@@ -24,4 +18,7 @@ def stop(logfile, errfile):
     proc.terminate()
     proc.terminate()
     proc.wait()
     proc.wait()
     proc = None
     proc = None
+
+    subprocess.call("sudo pkill gunicorn", shell=True, stderr=errfile, stdout=logfile)
+
     return 0
     return 0

+ 4 - 6
bottle/setup_py3.py

@@ -8,12 +8,7 @@ proc = None
 
 
 def start(args, logfile, errfile):
 def start(args, logfile, errfile):
     global proc
     global proc
-    proc = subprocess.Popen(
-        [BIN + "/gunicorn",
-         "-c", "gunicorn_conf.py",
-         "-e", "DBHOSTNAME=" + args.database_host,
-         "app:app"],
-        cwd="bottle", stderr=errfile, stdout=logfile)
+    proc = subprocess.Popen( "$PY3_GUNICORN -c gunicorn_conf.py -e DBHOSTNAME=%s app:app" % args.database_host, cwd="bottle", shell=True, stderr=errfile, stdout=logfile)
     return 0
     return 0
 
 
 
 
@@ -24,4 +19,7 @@ def stop(logfile, errfile):
     proc.terminate()
     proc.terminate()
     proc.wait()
     proc.wait()
     proc = None
     proc = None
+
+    subprocess.call("sudo pkill gunicorn", shell=True, stderr=errfile, stdout=logfile)
+
     return 0
     return 0

+ 4 - 8
bottle/setup_pypy.py

@@ -1,19 +1,12 @@
 import subprocess
 import subprocess
 import os
 import os
 
 
-BIN = os.path.expanduser('~/FrameworkBenchmarks/installs/pypy/bin')
 
 
 proc = None
 proc = None
 
 
-
 def start(args, logfile, errfile):
 def start(args, logfile, errfile):
     global proc
     global proc
-    proc = subprocess.Popen(
-        [BIN + "/gunicorn",
-         "-c", "gunicorn_conf.py",
-         "-e", "DBHOSTNAME=" + args.database_host,
-         "app:app"],
-        cwd="bottle", stderr=errfile, stdout=logfile)
+    proc = subprocess.Popen( "$PYPY_GUNICORN -c gunicorn_conf.py -e DBHOSTNAME=%s app:app" % args.database_host, cwd="bottle", shell=True, stderr=errfile, stdout=logfile)
     return 0
     return 0
 
 
 
 
@@ -24,4 +17,7 @@ def stop(logfile, errfile):
     proc.terminate()
     proc.terminate()
     proc.wait()
     proc.wait()
     proc = None
     proc = None
+
+    subprocess.call("sudo pkill gunicorn", shell=True, stderr=errfile, stdout=logfile)
+
     return 0
     return 0