From 86df9fc17e057b01d7eece3c148378d86092d4c7 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 29 Nov 2007 09:35:50 +0000 Subject: [PATCH] Make elog_process() pre-load log modules that it can be called just for that purpose. (trunk r8751) svn path=/main/branches/2.1.2/; revision=8752 --- pym/portage.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pym/portage.py b/pym/portage.py index 88f0b3fb4..c1527a4d4 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -495,6 +495,25 @@ class digraph: _elog_mod_imports = {} _elog_atexit_handlers = [] def elog_process(cpv, mysettings): + + global _elog_mod_imports + logsystems = mysettings.get("PORTAGE_ELOG_SYSTEM","").split() + for s in logsystems: + # allow per module overrides of PORTAGE_ELOG_CLASSES + if ":" in s: + s, levels = s.split(":", 1) + levels = levels.split(",") + # - 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) + if m is None: + m = getattr(logmodule, "mod_"+s) + _elog_mod_imports[logmodule] = m + except ImportError: + pass + mylogfiles = listdir(mysettings["T"]+"/logging/") # shortcut for packages without any messages if len(mylogfiles) == 0: -- 2.26.2