[PATCH 4/5] Update the way we look for glade files, spokes, hubs and categories

Martin Sivak msivak at redhat.com
Wed Dec 19 15:09:15 UTC 2012


Anaconda will look for glade files also in the same directory
where the source file requesting it is located.

This patch also adds updates dictionaries to the list of
paths we use to look for spokes, hubs and categories.
---
 pyanaconda/ui/gui/__init__.py | 20 +++++++++++++++-----
 pyanaconda/ui/tui/__init__.py |  8 ++++++--
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index b3c74de..1ffc490 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -122,8 +122,13 @@ class GUIObject(common.UIObject):
 
     def _findUIFile(self):
         path = os.environ.get("UIPATH", "./:/tmp/updates/:/tmp/updates/ui/:/usr/share/anaconda/ui/")
-        for d in path.split(":"):
-            testPath = os.path.normpath(d + self.uiFile)
+        dirs = path.split(":")
+
+        # append the directory where this UIObject is defined
+        dirs.append(os.path.dirname(inspect.getfile(self.__class__)))
+
+        for d in dirs:
+            testPath = os.path.join(d, self.uiFile)
             if os.path.isfile(testPath) and os.access(testPath, os.R_OK):
                 return testPath
 
@@ -238,13 +243,18 @@ class GraphicalUserInterface(UserInterface):
 
     basemask = "pyanaconda.ui.gui"
     basepath = os.path.dirname(__file__)
+    updatepath = "/tmp/updates/pyanaconda/ui/gui"
+
     paths = UserInterface.paths + {
             "categories": [(basemask + ".categories.%s",
-                        os.path.join(basepath, "categories"))],
+                        os.path.join(path, "categories"))
+                        for path in (updatepath, basepath)],
             "spokes": [(basemask + ".spokes.%s",
-                        os.path.join(basepath, "spokes"))],
+                        os.path.join(path, "spokes"))
+                        for path in (updatepath, basepath)],
             "hubs": [(basemask + ".hubs.%s",
-                      os.path.join(basepath, "hubs"))]
+                      os.path.join(path, "hubs"))
+                      for path in (updatepath, basepath)]
             }
         
     def _list_hubs(self):
diff --git a/pyanaconda/ui/tui/__init__.py b/pyanaconda/ui/tui/__init__.py
index b715d0a..1bf71e7 100644
--- a/pyanaconda/ui/tui/__init__.py
+++ b/pyanaconda/ui/tui/__init__.py
@@ -131,11 +131,15 @@ class TextUserInterface(ui.UserInterface):
 
     basemask = "pyanaconda.ui.tui"
     basepath = os.path.dirname(__file__)
+    updatepath = "/tmp/updates/pyanaconda/ui/tui"
+
     paths = ui.UserInterface.paths + {
             "spokes": [(basemask + ".spokes.%s",
-                        os.path.join(basepath, "spokes"))],
+                        os.path.join(path, "spokes"))
+                        for path in (updatepath, basepath)],
             "hubs": [(basemask + ".hubs.%s",
-                      os.path.join(basepath, "hubs"))]
+                      os.path.join(path, "hubs"))
+                      for path in (updatepath, basepath)]
             }
     
     def _list_hubs(self):
-- 
1.7.11.7



More information about the anaconda-patches mailing list