[PATCH 1/2] Use ksdata.addons instead of ksdata.addon and add ADDON_PATHS to sys.path

Vratislav Podzimek vpodzime at redhat.com
Tue Feb 12 15:05:34 UTC 2013


'ksdata.addons' makes more sense than 'ksdata.addon' since it is a root
of the tree where addons live.

ADDON_PATHS are needed in sys.path so that imports in addons' sources
work.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 anaconda                | 4 ++++
 pyanaconda/addons.py    | 2 +-
 pyanaconda/install.py   | 4 ++--
 pyanaconda/kickstart.py | 8 ++++----
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/anaconda b/anaconda
index 10d1abb..ee888bb 100755
--- a/anaconda
+++ b/anaconda
@@ -297,6 +297,10 @@ def setupPythonPath():
     # First add our updates path
     sys.path.insert(0, '/tmp/updates/')
 
+    from pyanaconda.constants import ADDON_PATHS
+    # append ADDON_PATHS dirs at the end
+    sys.path.extend(ADDON_PATHS)
+
 def setupEnvironment():
     # Silly GNOME stuff
     if os.environ.has_key('HOME') and not os.environ.has_key("XAUTHORITY"):
diff --git a/pyanaconda/addons.py b/pyanaconda/addons.py
index 4d81748..2500f25 100644
--- a/pyanaconda/addons.py
+++ b/pyanaconda/addons.py
@@ -148,7 +148,7 @@ class AddonSection(Section):
         if not self.addon_id:
             return
 
-        addon = getattr(self.handler.addon, self.addon_id)
+        addon = getattr(self.handler.addons, self.addon_id)
         addon.handle_line(line)
 
     def handleHeader(self, lineno, args):
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 9a55a9c..3c31b47 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -80,7 +80,7 @@ def doConfiguration(storage, payload, ksdata, instClass):
         ksdata.user.execute(storage, ksdata, instClass, u)
 
     with progress_report(_("Configuring addons")):
-        ksdata.addon.execute(storage, ksdata, instClass, u)
+        ksdata.addons.execute(storage, ksdata, instClass, u)
         ksdata.configured_spokes.execute(storage, ksdata, instClass, u)
         
     with progress_report(_("Running post install scripts")):
@@ -113,7 +113,7 @@ def doInstall(storage, payload, ksdata, instClass):
     progress.send_init(steps)
 
     with progress_report(_("Setting up the install environment")):
-        ksdata.addon.setup(storage, ksdata, instClass)
+        ksdata.addons.setup(storage, ksdata, instClass)
 
     # Do partitioning.
     payload.preStorage()
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index a93c552..a1830f3 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1402,13 +1402,13 @@ class AnacondaKSHandler(superclass):
 
         # Prepare the structure to track configured spokes
         self.configured_spokes = SpokeRegistry()
-        
+
         # Prepare the final structures for 3rd party addons
-        self.addon = AddonRegistry(addons)    
+        self.addons = AddonRegistry(addons)
 
     def __str__(self):
-        return superclass.__str__(self) + "\n" +  str(self.addon)
-        
+        return superclass.__str__(self) + "\n" +  str(self.addons)
+
 class AnacondaPreParser(KickstartParser):
     # A subclass of KickstartParser that only looks for %pre scripts and
     # sets them up to be run.  All other scripts and commands are ignored.
-- 
1.7.11.7



More information about the anaconda-patches mailing list