|
80 | 80 | # https://pypi.python.org/pypi/python-graph-dot |
81 | 81 | import pygraph.readwrite.dot as dot |
82 | 82 | # graphviz (used for creating dependency graph images) |
83 | | - sys.path.append('..') |
84 | | - sys.path.append('/usr/lib/graphviz/python/') |
85 | | - sys.path.append('/usr/lib64/graphviz/python/') |
86 | | - # Python bindings to Graphviz (http://www.graphviz.org/), |
87 | | - # see https://pypi.python.org/pypi/graphviz-python |
88 | | - # graphviz-python (yum) or python-pygraphviz (apt-get) |
89 | | - # or brew install graphviz --with-bindings (OS X) |
90 | | - import gv |
| 83 | + import graphviz |
91 | 84 | except ImportError: |
92 | 85 | pass |
93 | 86 |
|
@@ -244,13 +237,14 @@ def _dep_graph_dump(dgr, filename): |
244 | 237 | return _dep_graph_gv(dottxt, filename) |
245 | 238 |
|
246 | 239 |
|
247 | | -@only_if_module_is_available('gv', pkgname='graphviz-python') |
| 240 | +@only_if_module_is_available('graphviz', pkgname='graphviz') |
248 | 241 | def _dep_graph_gv(dottxt, filename): |
249 | 242 | """Render dependency graph to file using graphviz.""" |
250 | 243 | # try and render graph in specified file format |
251 | | - gvv = gv.readstring(dottxt) |
252 | | - if gv.layout(gvv, 'dot') is not False: |
253 | | - return gv.render(gvv, os.path.splitext(filename)[-1], filename) |
| 244 | + gvv = graphviz.Source(dottxt) |
| 245 | + if gvv.pipe(): |
| 246 | + name, ext = os.path.splitext(filename) |
| 247 | + return gvv.render(filename=name, format=ext[1:], cleanup=True) |
254 | 248 |
|
255 | 249 |
|
256 | 250 | def get_paths_for(subdir=EASYCONFIGS_PKG_SUBDIR, robot_path=None): |
|
0 commit comments