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:
Cas Cremers
2013-12-09 14:24:57 +00:00
parent 7e3f0ed73b
commit c9b1d08f4f
3 changed files with 136 additions and 18 deletions

View File

@@ -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)