Commit 0ce64fb3 authored by Daniel Brown's avatar Daniel Brown
Browse files

fixing somethings to get working on python 2.6 and git

parent 2bfc6dc0
import subprocess as sub import subprocess as sub
import os import os
GIT_BIN = "c:\\cygwin64\\bin\\git" GIT_BIN = "/usr/bin/git"
class RunException(Exception): class RunException(Exception):
def __init__(self, returncode, args, err, out): def __init__(self, returncode, args, err, out):
...@@ -23,13 +23,13 @@ def git(args): ...@@ -23,13 +23,13 @@ def git(args):
print os.getcwd() print os.getcwd()
p = sub.Popen(cmd, stdout=sub.PIPE, stderr=sub.PIPE) p = sub.Popen(cmd, stdout=sub.PIPE, stderr=sub.PIPE,shell=True)
out, err = p.communicate() out, err = p.communicate()
if p.returncode != 0: if p.returncode != 0:
print "STDERR: " + err print "STDERR: " + err
print "STDOUT: " + err print "STDOUT: " + err
raise RunException(p.returncode, args, err, out) raise RunException(p.poll(), args, err, out)
return [out, err] return [out, err]
...@@ -3,7 +3,7 @@ import sys ...@@ -3,7 +3,7 @@ import sys
from flask import Flask from flask import Flask
from pykat.testing import utils from pykat.testing import utils
def start(instance_path,port=5000, debug=False): def start(instance_path,port=5000, debug=True, ip="0.0.0.0"):
global app global app
print "starting web server..." print "starting web server..."
...@@ -21,27 +21,28 @@ def start(instance_path,port=5000, debug=False): ...@@ -21,27 +21,28 @@ def start(instance_path,port=5000, debug=False):
from pykat.testing.web import app from pykat.testing.web import app
if(app.instance_path!=instance_path): if(app.instance_path!=instance_path):
print app.instance_path, instance_path
raise Exception("Instance path of Flask app didn't match the requested value") raise Exception("Instance path of Flask app didn't match the requested value")
# load up the actual interface code # load up the actual interface code
import pykat.testing.web.web_interface import pykat.testing.web.web_interface
# need local copy of src # need local copy of src
if not os.path.exists("./finesse_src"): if not os.path.exists(os.path.join(app.instance_path,"finesse_src")):
print "finesse src folder didn't exist, cloning now..." print "finesse src folder didn't exist, cloning now..."
utils.git("clone git://gitmaster.atlas.aei.uni-hannover.de/finesse/src.git finesse_src") utils.git(["clone","git://gitmaster.atlas.aei.uni-hannover.de/finesse/src.git","finesse_src"])
else: else:
os.chdir(os.path.join(app.instance_path,"finesse_src")) os.chdir(os.path.join(app.instance_path,"finesse_src"))
# get the latest version for logs etc. # get the latest version for logs etc.
utils.git("pull") utils.git("pull")
# need local copy of test # need local copy of test
if not os.path.exists("./finesse_test"): if not os.path.exists(os.path.join(app.instance_path,"finesse_test")):
print "finesse test folder didn't exist, cloning now..." print "finesse test folder didn't exist, cloning now..."
utils.git("clone git://gitmaster.atlas.aei.uni-hannover.de/finesse/test.git finesse_test") utils.git(["clone","git://gitmaster.atlas.aei.uni-hannover.de/finesse/test.git","finesse_test"])
app.secret_key = os.urandom(24) app.secret_key = os.urandom(24)
app.run(debug=debug, port=int(port)) app.run(debug=debug, port=int(port), host=ip)
if __name__ == "__main__": if __name__ == "__main__":
n = len(sys.argv) n = len(sys.argv)
...@@ -70,4 +71,7 @@ start_test_server usage: ...@@ -70,4 +71,7 @@ start_test_server usage:
port = 5000 port = 5000
start(instance_path, port=port) start(instance_path, port=port)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment