[PATCH] Split out anaconda's user interfaces into separate packages (#1012509)

Vratislav Podzimek vpodzime at redhat.com
Tue Sep 2 12:23:17 UTC 2014


Ported changes from commits
7161c69c9c10e79a0f2a89db99b7edc120384c95
06f7e38bc9f9ba445e61fe6ec648d64b54a45af4
b62a760e8de18a5fee1daaac496bd4df6aff5f15
eb7ae0f9e51ce03653fa25ba0de26eef4c3bfa08
9fe0091c3fde28a06b4588276f7897cfab50f77a
9784e31511aa7db2da810357a5566b230004aa25
8df36acfb7ebdcf62e598e3d28f31b8d4d5103b8
a8255d924c1007931d63212c5a29dd355e35cbe2
b48980dd206ba61364f382ab74a5eb3ae7770fd2

from master.

Related: rhbz#999464
Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 anaconda                    | 10 ++++++++++
 anaconda.spec.in            |  5 -----
 configure.ac                |  4 ----
 pyanaconda/isys/Makefile.am |  2 +-
 pyanaconda/isys/isys.c      | 26 --------------------------
 pyanaconda/keyboard.py      |  4 ++--
 6 files changed, 13 insertions(+), 38 deletions(-)

diff --git a/anaconda b/anaconda
index 0fa742f..8b2f736 100755
--- a/anaconda
+++ b/anaconda
@@ -489,6 +489,16 @@ def setupDisplay(anaconda, opts, addon_paths=None):
         if vncS.vncconnectport == "":
             vncS.vncconnectport = anaconda.ksdata.vnc.port
 
+    if anaconda.displayMode == "g":
+        try:
+            # pylint: disable-msg=W0612
+            from pyanaconda.ui.gui import GraphicalUserInterface
+        except ImportError:
+            stdoutLog.warning("Graphical user interface not available, falling back to text mode")
+            anaconda.displayMode = "t"
+            flags.usevnc = 0
+            flags.vncquestion = False
+
     # disable VNC over text question when not enough memory is available
     if blivet.util.total_memory() < isys.MIN_GUI_RAM:
         stdoutLog.warning("Not asking for VNC because current memory (%d) < MIN_GUI_RAM (%d)", blivet.util.total_memory(), isys.MIN_GUI_RAM)
diff --git a/anaconda.spec.in b/anaconda.spec.in
index dff3c30..a9e4b0c 100644
--- a/anaconda.spec.in
+++ b/anaconda.spec.in
@@ -49,9 +49,6 @@ BuildRequires: gobject-introspection-devel
 BuildRequires: glade-devel
 BuildRequires: pygobject3
 BuildRequires: intltool >= %{intltoolver}
-BuildRequires: libX11-devel
-BuildRequires: libXt-devel
-BuildRequires: libXxf86misc-devel
 BuildRequires: libgnomekbd-devel
 BuildRequires: libnl-devel >= %{libnlver}
 BuildRequires: libxklavier-devel
@@ -157,7 +154,6 @@ system.
 
 %package gui
 Summary: Graphical user interface for the Anaconda installer
-BuildArch: noarch
 Requires: anaconda-core = %{version}-%{release}
 Requires: anaconda-widgets = %{version}-%{release}
 Requires: python-meh-gui >= %{mehver}
@@ -176,7 +172,6 @@ This package contains graphical user interface for the Anaconda installer.
 
 %package tui
 Summary: Textual user interface for the Anaconda installer
-BuildArch: noarch
 Requires: anaconda-core = %{version}-%{release}
 
 %description tui
diff --git a/configure.ac b/configure.ac
index e6f9d2a..25eaf23 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,10 +67,6 @@ AC_SUBST(INTLTOOL_DESKTOP_RULE)
 AM_GNU_GETTEXT([external])
 
 # Checks for libraries.
-AC_CHECK_LIB([X11], [XGetWindowAttributes],
-             [AC_SUBST(X11_LIBS, [-lX11])],
-             [AC_MSG_FAILURE([*** libX11 not usable.])])
-
 AC_CHECK_LIB([audit], [audit_open],
              [AC_SUBST(AUDIT_LIBS, [-laudit])],
              [AC_MSG_FAILURE([*** libaudit not usable.])])
diff --git a/pyanaconda/isys/Makefile.am b/pyanaconda/isys/Makefile.am
index 3f37d45..7ad53bf 100644
--- a/pyanaconda/isys/Makefile.am
+++ b/pyanaconda/isys/Makefile.am
@@ -27,7 +27,7 @@ ISYS_CFLAGS = -DVERSION='"$(PACKAGE_VERSION)-$(PACKAGE_RELEASE)"' \
               $(NETWORKMANAGER_CFLAGS) $(LIBNL_CFLAGS) $(LIBNM_GLIB_CFLAGS) \
               $(SELINUX_CFLAGS)
 ISYS_LIBS   = $(RESOLV_LIBS) $(ZLIB_LIBS) \
-              $(DEVMAPPER_LIBS) $(X11_LIBS) $(SELINUX_LIBS) \
+              $(DEVMAPPER_LIBS) $(SELINUX_LIBS) \
               $(LIBNL_LIBS) $(LIBNM_GLIB_LIBS)
 
 isysdir     = $(pkgpyexecdir)/isys
diff --git a/pyanaconda/isys/isys.c b/pyanaconda/isys/isys.c
index 7848504..17e85da 100644
--- a/pyanaconda/isys/isys.c
+++ b/pyanaconda/isys/isys.c
@@ -58,10 +58,6 @@
 #include <signal.h>
 #include <execinfo.h>
 
-#include <X11/Xlib.h>
-#include <X11/XKBlib.h>
-#include <X11/keysym.h>
-
 #include "isys.h"
 #include "auditd.h"
 #include "log.h"
@@ -79,7 +75,6 @@ static PyObject * printObject(PyObject * s, PyObject * args);
 static PyObject * py_bind_textdomain_codeset(PyObject * o, PyObject * args);
 static PyObject * doSegvHandler(PyObject *s, PyObject *args);
 static PyObject * doAuditDaemon(PyObject *s);
-static PyObject * doIsCapsLockEnabled(PyObject * s, PyObject * args);
 static PyObject * doGetAnacondaVersion(PyObject * s, PyObject * args);
 static PyObject * doInitLog(PyObject * s);
 static PyObject * doTotalMemory(PyObject * s);
@@ -93,7 +88,6 @@ static PyMethodDef isysModuleMethods[] = {
     { "bind_textdomain_codeset", (PyCFunction) py_bind_textdomain_codeset, METH_VARARGS, NULL},
     { "handleSegv", (PyCFunction) doSegvHandler, METH_VARARGS, NULL },
     { "auditdaemon", (PyCFunction) doAuditDaemon, METH_NOARGS, NULL },
-    { "isCapsLockEnabled", (PyCFunction) doIsCapsLockEnabled, METH_VARARGS, NULL },
     { "getAnacondaVersion", (PyCFunction) doGetAnacondaVersion, METH_VARARGS, NULL },
     { "initLog", (PyCFunction) doInitLog, METH_VARARGS, NULL },
     { "total_memory", (PyCFunction) doTotalMemory, METH_NOARGS, NULL },
@@ -230,26 +224,6 @@ static PyObject * doAuditDaemon(PyObject *s) {
     return Py_None;
 }
 
-static PyObject * doIsCapsLockEnabled(PyObject * s, PyObject * args) {
-    Display *d = NULL;
-    XkbStateRec state;
-
-    if ((d = XOpenDisplay(NULL)) == NULL) {
-        PyErr_SetString(PyExc_RuntimeError, "XOpenDisplay failed");
-        return NULL;
-    }
-
-    memset(&state, 0, sizeof(state));
-    XkbGetState(d, XkbUseCoreKbd, &state);
-
-    if (XCloseDisplay(d)) {
-        PyErr_SetString(PyExc_RuntimeError, "XCloseDisplay failed");
-        return NULL;
-    }
-
-    return PyBool_FromLong(state.locked_mods & LockMask);
-}
-
 static PyObject * doGetAnacondaVersion(PyObject * s, PyObject * args) {
     return Py_BuildValue("s", VERSION);
 }
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index aeab7f4..9c02a1d 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -47,7 +47,7 @@ from pyanaconda.safe_dbus import dbus_call_safe_sync, dbus_get_property_safe_syn
 from pyanaconda.safe_dbus import DBUS_SYSTEM_BUS_ADDR, DBusPropertyError
 from pyanaconda.constants import DEFAULT_VC_FONT
 
-from gi.repository import Xkl, Gio, GLib
+from gi.repository import Gio, GLib
 
 import logging
 log = logging.getLogger("anaconda")
@@ -372,7 +372,7 @@ class XklWrapper(object):
         return XklWrapper._instance
 
     def __init__(self):
-        from gi.repository import GdkX11
+        from gi.repository import GdkX11, Xkl
 
         #initialize Xkl-related stuff
         display = GdkX11.x11_get_default_xdisplay()
-- 
1.9.3



More information about the anaconda-patches mailing list