summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-10-22 22:42:52 +0200
committerJan Pokorný <jpokorny@redhat.com>2013-10-22 22:42:52 +0200
commitf7337bbc39bbcbb1e41a0aba059ac70162d47fbd (patch)
tree54a6986a415525d560bfd071342b0e0f950d3559
parent8180c274b2380ef505f4c4b85e3b677a29fdf823 (diff)
downloadcluster-overview-f7337bbc39bbcbb1e41a0aba059ac70162d47fbd.zip
cluster-overview-f7337bbc39bbcbb1e41a0aba059ac70162d47fbd.tar.gz
cluster-overview-f7337bbc39bbcbb1e41a0aba059ac70162d47fbd.tar.xz
lib: more graceful handling of old xdot (as in PyPI)
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rw-r--r--lib.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib.py b/lib.py
index a4f01e3..90f6f45 100644
--- a/lib.py
+++ b/lib.py
@@ -6,6 +6,7 @@
"""Custom wrapping of pydot"""
from os.path import extsep
+from sys import stderr
from pydot import Dot, Edge, Node, Subgraph
REGISTRY = {}
@@ -148,7 +149,8 @@ def xdot_graph(*args, **kwargs):
try:
import xdot
except ImportError:
- print 'missing xdot; use "pip install xdot" or equivalent'
+ print >>stderr, 'missing xdot; (currently) recommended way to grab it:'
+ print >>stderr, 'pip install --user https://github.com/jrfonseca/xdot.py/archive/master.zip'
raise
class LibDotWidget(xdot.DotWidget):
@@ -262,7 +264,11 @@ def xdot_graph(*args, **kwargs):
self._args = args
self._kwargs = kwargs
self._can_change = True
- super(LibDotWindow, self).__init__(LibDotWidget())
+ try:
+ super(LibDotWindow, self).__init__(LibDotWidget())
+ except TypeError:
+ print >>stderr, "xdot too old, you won't get tooltips :-/"
+ super(LibDotWindow, self).__init__()
dotcode = gen_graph(*args, **kwargs).to_string()
title = dotcode[dotcode.find('digraph', 0, 512) + len('digraph')
: