----- Original Message -----
From: "Chris Lumens" <clumens(a)redhat.com>
To: anaconda-patches(a)lists.fedorahosted.org
Sent: Monday, December 2, 2013 3:54:13 PM
Subject: [PATCH] Change how we test if the GUI is available in the anaconda script.
Simply trying to import early on means we get the "Unable to init server" and
XDG_RUNTIME_DIR errors. Instead, test to see if the GUI is available to be
imported (which it will if it's included in the tree). We can still fall
back
to text mode if there are X problems, though.
---
anaconda | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/anaconda b/anaconda
index caf68a5..21b974a 100755
--- a/anaconda
+++ b/anaconda
@@ -489,10 +489,11 @@ def setupDisplay(anaconda, options, addons=None):
vncS.vncconnectport = anaconda.ksdata.vnc.port
if anaconda.displayMode == "g":
- try:
- # pylint: disable-msg=W0612
- from pyanaconda.ui.gui import GraphicalUserInterface
- except ImportError:
+ import pkgutil
+ import pyanaconda
+
+ mods = [lst[1] for lst in
list(pkgutil.iter_modules(pyanaconda.ui.__path__, "pyanaconda.ui."))]
+ if "pyanaconda.ui.gui" not in mods:
stdoutLog.warning("Graphical user interface not available,
falling back to text mode")
anaconda.displayMode = "t"
flags.usevnc = 0
--
1.8.3.1
It looks like you'll have to import pyanaconda.ui before the call to iter_modules.
Otherwise, looks good.
- mulhern
_______________________________________________
anaconda-patches mailing list
anaconda-patches(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches