- Minor improvements.
This commit is contained in:
parent
f7ee9743d2
commit
f823399a73
@ -23,6 +23,7 @@ from tempfile import NamedTemporaryFile, gettempdir
|
|||||||
CacheTimer = 0.1
|
CacheTimer = 0.1
|
||||||
ScytherProgram = "scyther"
|
ScytherProgram = "scyther"
|
||||||
RetrieveFromCache = True
|
RetrieveFromCache = True
|
||||||
|
LastArguments = ""
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# How to override Scyther program setting
|
# How to override Scyther program setting
|
||||||
@ -62,17 +63,28 @@ def scythercall (argumentstring, inputfile):
|
|||||||
# argstring: a smaller string
|
# argstring: a smaller string
|
||||||
def evaluate (argumentstring, inputstring):
|
def evaluate (argumentstring, inputstring):
|
||||||
|
|
||||||
def cacheid():
|
global LastArguments
|
||||||
m = md5.new()
|
|
||||||
|
|
||||||
|
def getversion():
|
||||||
# Determine scyther version
|
# Determine scyther version
|
||||||
(status, scout) = scythercall ("--version", "")
|
(status, scout) = scythercall ("--version", "")
|
||||||
if status == 1 or status < 0:
|
if status == 1 or status < 0:
|
||||||
# some problem
|
# some problem
|
||||||
print "Problem with determining scyther version!"
|
print "Problem with determining scyther version!"
|
||||||
os.exit()
|
os.exit()
|
||||||
# Add version to hash
|
ll = scout.splitlines()
|
||||||
m.update (scout)
|
versionline = ll[1].split()
|
||||||
|
if versionline[0] != "Revision":
|
||||||
|
print "Could not find revision ID in:"
|
||||||
|
print scout
|
||||||
|
|
||||||
|
return versionline[1]
|
||||||
|
|
||||||
|
def cacheid():
|
||||||
|
m = md5.new()
|
||||||
|
|
||||||
|
# Determine scyther version
|
||||||
|
m.update (version)
|
||||||
|
|
||||||
# Add inputfile to hash
|
# Add inputfile to hash
|
||||||
m.update (inputstring)
|
m.update (inputstring)
|
||||||
@ -96,9 +108,9 @@ def evaluate (argumentstring, inputstring):
|
|||||||
|
|
||||||
# Determine name
|
# Determine name
|
||||||
def cachefilename(id):
|
def cachefilename(id):
|
||||||
fn = gettempdir() + "/scyther/"
|
fn = gettempdir() + "/scyther/" + version + "/"
|
||||||
fn = fn + slashcutter(id,"/",3,2)
|
fn += slashcutter(id,"/",3,2)
|
||||||
fn = fn + ".txt"
|
fn += ".txt"
|
||||||
return fn
|
return fn
|
||||||
|
|
||||||
# Ensure directory
|
# Ensure directory
|
||||||
@ -143,6 +155,12 @@ def evaluate (argumentstring, inputstring):
|
|||||||
#print "Retrieved cached version for [%s]." % argumentstring
|
#print "Retrieved cached version for [%s]." % argumentstring
|
||||||
return (0,res)
|
return (0,res)
|
||||||
|
|
||||||
|
# Retrieve version
|
||||||
|
version = getversion()
|
||||||
|
|
||||||
|
# Store for later refernce
|
||||||
|
LastArguments = argumentstring
|
||||||
|
|
||||||
# Determine the unique filename for this test
|
# Determine the unique filename for this test
|
||||||
cachefile = cachefilename(cacheid())
|
cachefile = cachefilename(cacheid())
|
||||||
if os.path.exists(cachefile) and RetrieveFromCache:
|
if os.path.exists(cachefile) and RetrieveFromCache:
|
||||||
|
@ -72,9 +72,10 @@ def add_extra_parameters(args):
|
|||||||
global g_extra
|
global g_extra
|
||||||
|
|
||||||
if args != "":
|
if args != "":
|
||||||
if g_extra != "":
|
if g_extra.find(args) == -1:
|
||||||
g_extra = g_extra + " "
|
if g_extra != "":
|
||||||
g_extra = g_extra + args
|
g_extra = g_extra + " "
|
||||||
|
g_extra = g_extra + args
|
||||||
|
|
||||||
# Yield arguments, given a bound type:
|
# Yield arguments, given a bound type:
|
||||||
# 0: fast
|
# 0: fast
|
||||||
|
Loading…
Reference in New Issue
Block a user