[virt-tools-list] [virt-manager PATCH] Make SpiceClientGtk optional
Guido Günther
agx at sigxcpu.org
Fri Nov 7 19:36:49 UTC 2014
It's not available on all architectures. This allows us to turn
the hard dependency into a soft on.
---
virtManager/console.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/virtManager/console.py b/virtManager/console.py
index 67bfe10..54e476f 100644
--- a/virtManager/console.py
+++ b/virtManager/console.py
@@ -24,8 +24,12 @@ from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GtkVnc
-from gi.repository import SpiceClientGtk
-from gi.repository import SpiceClientGLib
+try:
+ from gi.repository import SpiceClientGtk
+ from gi.repository import SpiceClientGLib
+ have_spice_gtk = True
+except ImportError:
+ have_spice_gtk = False
import libvirt
@@ -1253,7 +1257,10 @@ class vmmConsolePages(vmmGObjectUI):
if ginfo.gtype == "vnc":
self.viewer = VNCViewer(self)
elif ginfo.gtype == "spice":
- self.viewer = SpiceViewer(self)
+ if have_spice_gtk:
+ self.viewer = SpiceViewer(self)
+ else:
+ raise RuntimeError("Error opening Spice console, SpiceClientGtk missing")
self.set_enable_accel()
--
2.1.1
More information about the virt-tools-list
mailing list