Fix broken module loading logic.
authorZac Medico <zmedico@gentoo.org>
Fri, 30 Nov 2007 19:38:48 +0000 (19:38 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 30 Nov 2007 19:38:48 +0000 (19:38 -0000)
svn path=/main/branches/2.1.2/; revision=8767

pym/portage.py

index 6033cf609fcfe712acba91ac9eb982814436de33..fe8088e4cde3d643357002384aa2bb27002aab42 100644 (file)
@@ -506,11 +506,12 @@ def elog_process(cpv, mysettings):
                # - is nicer than _ for module names, so allow people to use it.
                s = s.replace("-", "_")
                try:
-                       logmodule = __import__("elog_modules.mod_"+s)
-                       m = _elog_mod_imports.get(logmodule)
+                       name = "elog_modules.mod_"+s
+                       m = _elog_mod_imports.get(name)
                        if m is None:
+                               logmodule = __import__(name)
                                m = getattr(logmodule, "mod_"+s)
-                               _elog_mod_imports[logmodule] = m
+                               _elog_mod_imports[name] = m
                except ImportError:
                        pass
 
@@ -585,11 +586,12 @@ def elog_process(cpv, mysettings):
                try:
                        # FIXME: ugly ad.hoc import code
                        # TODO:  implement a common portage module loader
-                       logmodule = __import__("elog_modules.mod_"+s)
-                       m = _elog_mod_imports.get(logmodule)
+                       name = "elog_modules.mod_"+s
+                       m = _elog_mod_imports.get(name)
                        if m is None:
+                               logmodule = __import__(name)
                                m = getattr(logmodule, "mod_"+s)
-                               _elog_mod_imports[logmodule] = m
+                               _elog_mod_imports[name] = m
                        def timeout_handler(signum, frame):
                                raise portage_exception.PortageException(
                                        "Timeout in elog_process for system '%s'" % s)