On Mon, 2013-12-02 at 15:54 -0500, Chris Lumens wrote:
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."))]
Is there any reason for creating two temporary lists,
here? Couldn't it
look like this?
mods = (item[1] for item in pkgutil.iter_modules(pyanaconda.ui.__path__,
"pyanaconda.ui.")
Other than that and mulhern's comment this looks good to me. Nice idea!
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic