- Improved locating binaries etc.

This commit is contained in:
ccremers 2006-11-23 11:28:51 +00:00
parent ec9bf11719
commit 17f4f34d23
5 changed files with 55 additions and 53 deletions

View File

@ -77,8 +77,8 @@ class SettingsWindow(wx.Panel):
### MISC expert stuff ### MISC expert stuff
grid.titleAdd("Advanced parameters") grid.titleAdd("Advanced parameters")
# Bound on the number of classes/attacks # Bound on the number of patterns
self.maxattacks = int(Preference.get('maxattacks','100')) self.maxattacks = int(Preference.get('maxattacks','10'))
stname = Claim.stateDescription(True,2,False) stname = Claim.stateDescription(True,2,False)
atname = Claim.stateDescription(False,2,False) atname = Claim.stateDescription(False,2,False)
txt = "%s/%s" % (stname,atname) txt = "%s/%s" % (stname,atname)

View File

@ -19,10 +19,10 @@ from Misc import *
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Globals """ """
bindir="../Bin" The default path for the binaries is set in __init__.py in the (current)
directory 'Scyther'.
#--------------------------------------------------------------------------- """
def setBinDir(dir): def setBinDir(dir):
global bindir global bindir
@ -36,41 +36,48 @@ def getBinDir():
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def getScytherBackend():
# Where is my executable?
#
# Auto-detect platform and infer executable name from that
#
if "linux" in sys.platform:
""" linux """
scythername = "scyther-linux"
elif "darwin" in sys.platform:
""" OS X """
# Preferably, we test for architecture (PPC/Intel) until we
# know how to build a universal binary
scythername = "scyther-osx"
elif sys.platform.startswith('win'):
""" Windows """
scythername = "Scyther.exe"
else:
""" Unsupported"""
print "ERROR: I'm sorry, the %s platform is unsupported at the moment" % (sys.platform)
sys.exit()
program = os.path.join(getBinDir(),scythername)
if not os.path.isfile(program):
print "I can't find the Scyther executable at %s" % (program)
return None
return program
#---------------------------------------------------------------------------
class Scyther(object): class Scyther(object):
def __init__ ( self): def __init__ ( self):
global bindir
# Where is my executable?
#
# Auto-detect platform and infer executable name from that
#
prefix = os.path.abspath(bindir)
if "linux" in sys.platform:
""" linux """
self.program = os.path.join(prefix,"scyther")
elif "darwin" in sys.platform:
""" OS X """
# Preferably, we test for architecture (PPC/Intel) until we
# know how to build a universal binary
self.program = os.path.join(prefix,"scyther-osx")
elif sys.platform.startswith('win'):
""" Windows """
# TODO hardcoded for now, bad
self.program = os.path.join(prefix,"Scyther.exe")
if not os.path.isfile(self.program):
print "I can't find the Scyther executable at %s" % (self.program)
else:
""" Unsupported"""
print "ERROR: I'm sorry, the %s platform is unsupported at the moment" % (sys.platform)
sys.exit()
# Init # Init
self.program = getScytherBackend()
self.spdl = None self.spdl = None
self.inputfile = None self.inputfile = None
self.options = "" self.options = ""
@ -105,6 +112,10 @@ class Scyther(object):
fp.close() fp.close()
def verify(self): def verify(self):
""" Should return a list of results """
if self.program == None:
return []
# Run Scyther on temp file # Run Scyther on temp file
self.cmd = "\"%s\"" % self.program self.cmd = "\"%s\"" % self.program

View File

@ -5,5 +5,7 @@
# order to correctly find the executables # order to correctly find the executables
# #
import Scyther import Scyther
import os.path
Scyther.setBinDir(__path__[0]) bindir = os.path.join(__path__[0],"..","Bin")
Scyther.setBinDir(bindir)

View File

@ -1,15 +0,0 @@
#!/bin/sh
SVNDIR=https://svn.win.tue.nl/repos/ecss/trunk/protocols/spdl/scyther
TMPDIR=/tmp/ecsslatesscyther
VERSIONFILE=$TMPDIR/version.txt
SCYTHER=$TMPDIR/scyther
rm -rf $TMPDIR
svn co $SVNDIR $TMPDIR
cp scyther $SCYTHER
$SCYTHER --version >$VERSIONFILE
cat $VERSIONFILE
svn commit --file $VERSIONFILE $SCYTHER
echo "Committed this version to the ECSS repository."

4
src/copy2gui.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
cp scyther-linux ../gui/Bin