diff options
author | Mike Frysinger <vapier@gentoo.org> | 2012-03-10 23:15:31 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2012-03-11 15:41:42 -0400 |
commit | 6e4f1bd23cbb3332fa1d4f1e570420b743e01296 (patch) | |
tree | abf50a649ecd76a7c41778bc959b64b2b72b25ba /pym/portage | |
parent | e9bb70344f93509e34ef117e14420a60fef5b83e (diff) | |
download | portage-6e4f1bd23cbb3332fa1d4f1e570420b743e01296.tar.gz portage-6e4f1bd23cbb3332fa1d4f1e570420b743e01296.tar.bz2 portage-6e4f1bd23cbb3332fa1d4f1e570420b743e01296.zip |
portageq: add "colormap" helper
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/output.py | 6 | ||||
-rw-r--r-- | pym/portage/package/ebuild/doebuild.py | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py index 43d75036e..98bec8143 100644 --- a/pym/portage/output.py +++ b/pym/portage/output.py @@ -325,6 +325,12 @@ def style_to_ansi_code(style): ret += codes.get(attr_name, attr_name) return ret +def colormap(): + mycolors = [] + for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET", "NORMAL"): + mycolors.append("%s=$'%s'" % (c, style_to_ansi_code(c))) + return "\n".join(mycolors) + def colorize(color_key, text): global havecolor if havecolor: diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index c45aa030a..4ff3eeaf7 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -50,7 +50,7 @@ from portage.exception import DigestException, FileNotFound, \ IncorrectParameter, InvalidDependString, PermissionDenied, \ UnsupportedAPIException from portage.localization import _ -from portage.output import style_to_ansi_code +from portage.output import colormap from portage.package.ebuild.prepare_build_dirs import prepare_build_dirs from portage.util import apply_recursive_permissions, \ apply_secpass_permissions, noiselimit, normalize_path, \ @@ -300,11 +300,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None, mysettings["PORTAGE_CONFIGROOT"], EBUILD_SH_ENV_DIR) # Allow color.map to control colors associated with einfo, ewarn, etc... - mycolors = [] - for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"): - mycolors.append("%s=$'%s'" % \ - (c, style_to_ansi_code(c))) - mysettings["PORTAGE_COLORMAP"] = "\n".join(mycolors) + mysettings["PORTAGE_COLORMAP"] = colormap() if "COLUMNS" not in mysettings: # Set COLUMNS, in order to prevent unnecessary stty calls |