diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-11-29 09:35:01 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-11-29 09:35:01 +0000 |
commit | 7533586dcc2c0351da28da56b9e6a2a1b9ea004d (patch) | |
tree | e1e90a745a0993b5011ae5f64176c71f5a4114d4 | |
parent | 94ea294e4b07a4f9cb5814a205510a899d1c106a (diff) | |
download | portage-7533586dcc2c0351da28da56b9e6a2a1b9ea004d.tar.gz portage-7533586dcc2c0351da28da56b9e6a2a1b9ea004d.tar.bz2 portage-7533586dcc2c0351da28da56b9e6a2a1b9ea004d.zip |
Make elog_process() pre-load log modules that it can be called
just for that purpose.
svn path=/main/trunk/; revision=8751
-rw-r--r-- | pym/portage/elog/__init__.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index c68fedca0..d3e333534 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -46,6 +46,27 @@ _elog_mod_imports = {} _elog_atexit_handlers = [] _preserve_logentries = {} def elog_process(cpv, mysettings, phasefilter=None): + + 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: + name = "portage.elog.mod_" + s + m = _elog_mod_imports.get(name) + if m is None: + m = __import__(name) + for comp in name.split(".")[1:]: + m = getattr(m, comp) + _elog_mod_imports[name] = m + except ImportError: + pass + ebuild_logentries = collect_ebuild_messages(os.path.join(mysettings["T"], "logging")) all_logentries = collect_messages() if all_logentries.has_key(cpv): |