diff treepkg/readconfig.py @ 114:02c261e4443f

Extend treepkg.readconfig.read_config: - use import_packager_module - allow %(name)s substitutions in packager_class values in the pkg_* sections
author Bernhard Herzog <bh@intevation.de>
date Tue, 01 Apr 2008 13:27:21 +0000
parents 73c67372c7f7
children d7b53e7df961
line wrap: on
line diff
--- a/treepkg/readconfig.py	Tue Apr 01 12:30:39 2008 +0000
+++ b/treepkg/readconfig.py	Tue Apr 01 13:27:21 2008 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2007 by Intevation GmbH
+# Copyright (C) 2007, 2008 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh@intevation.de>
 #
@@ -12,6 +12,7 @@
 from ConfigParser import SafeConfigParser, NoOptionError
 
 import util
+import packager
 
 defaults = dict(root_cmd="sudo")
 
@@ -62,11 +63,12 @@
     packagers = []
     for section in parser.sections():
         if section.startswith("pkg_"):
-            packager_class = parser.get(section, "packager_class")
-            module = util.import_dotted_name(packager_class)
+            vars = dict(name=section[4:])
+            packager_class = parser.get(section, "packager_class", vars=vars)
+            module = packager.import_packager_module(packager_class)
             desc = packager_desc + module.PackageTrack.extra_config_desc
             packagers.append(read_config_section(parser, section, desc,
-                                                 dict(name=section[4:])))
+                                                 defaults=vars))
 
     # main config
     treepkg = read_config_section(parser, "treepkg", treepkg_desc)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)