Fix broken imports.
authorZac Medico <zmedico@gentoo.org>
Tue, 13 Feb 2007 19:57:44 +0000 (19:57 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 13 Feb 2007 19:57:44 +0000 (19:57 -0000)
svn path=/main/trunk/; revision=5963

pym/portage/elog/__init__.py

index 5ba49793d4b852c811d3b0fdc5e6de4e0c96a6f2..c6f6ec47c60420f703c5a5bb5e81ae8582e4b4bd 100644 (file)
@@ -80,8 +80,10 @@ def elog_process(cpv, mysettings):
                try:
                        # FIXME: ugly ad.hoc import code
                        # TODO:  implement a common portage module loader
-                       logmodule = __import__("portage.elog.mod_"+s)
-                       m = getattr(logmodule, "mod_"+s)
+                       name = "portage.elog.mod_" + s
+                       m = __import__(name)
+                       for comp in name.split(".")[1:]:
+                               m = getattr(m, comp)
                        def timeout_handler(signum, frame):
                                raise PortageException("Timeout in elog_process for system '%s'" % s)
                        import signal
@@ -100,7 +102,7 @@ def elog_process(cpv, mysettings):
                        writemsg("!!! Error while importing logging modules " + \
                                "while loading \"mod_%s\":\n" % str(s))
                        writemsg("%s\n" % str(e), noiselevel=-1)
-               except portage.exception.PortageException, e:
+               except PortageException, e:
                        writemsg("%s\n" % str(e), noiselevel=-1)
 
        # clean logfiles to avoid repetitions