Hack for Windows users to compensate for Graphviz "feature".
Recent versions of Graphviz no longer set the PATH variable on Windows. Hence Scyther can fail to find dot.exe even though Graphviz was appropriately installed. This patch is a hack to try and locate dot.exe in the more common locations. We currently have a hardcoded search through: C:\Program Files\Graphviz* C:\Program Files (x86)\Graphviz* This is clearly fragile. Obviously, nobody should be solving Graphviz' problem in such an ugly way. Change drives or languages and it stops working. Until Graphviz provides at least an alternative environment variable (GVPATH?) this hack will help the bulk of our users to get things up and running smoothly.
This commit is contained in:
@@ -31,6 +31,7 @@ from subprocess import Popen, PIPE
|
||||
|
||||
""" Import scyther components """
|
||||
from Scyther import Misc as MiscScyther
|
||||
from Scyther import FindDot
|
||||
|
||||
""" Import scyther-gui components """
|
||||
import Temporary
|
||||
@@ -124,12 +125,15 @@ def makeImageDot(dotdata,attackthread=None):
|
||||
type = "png"
|
||||
ext = ".png"
|
||||
|
||||
# Retrieve dot command path
|
||||
dotcommand = FindDot.findDot()
|
||||
|
||||
# command to write to temporary file
|
||||
(fd2,fpname2) = Temporary.tempcleaned(ext)
|
||||
f = os.fdopen(fd2,'w')
|
||||
|
||||
# Set up command
|
||||
cmd = "dot -T%s" % (type)
|
||||
cmd = "%s -T%s" % (dotcommand,type)
|
||||
|
||||
# execute command
|
||||
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE)
|
||||
|
||||
Reference in New Issue
Block a user