summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-06-17 18:59:14 +0000
committerZac Medico <zmedico@gentoo.org>2009-06-17 18:59:14 +0000
commit0794b36b2db8cdb1b3b3ebfe6945a5be672a839c (patch)
treefe73daeeed824e5fcdb697e169a64fd22737f669
parent55c3ceebe5c81147ee03f9b03c577f3958d88d1d (diff)
downloadportage-0794b36b2db8cdb1b3b3ebfe6945a5be672a839c.tar.gz
portage-0794b36b2db8cdb1b3b3ebfe6945a5be672a839c.tar.bz2
portage-0794b36b2db8cdb1b3b3ebfe6945a5be672a839c.zip
Rename map_code_to_color_code() to style_to_ansi_code().
svn path=/main/trunk/; revision=13646
-rw-r--r--pym/portage/__init__.py2
-rw-r--r--pym/portage/output.py17
2 files changed, 13 insertions, 6 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index c17072870..7eb9dd69d 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -5432,7 +5432,7 @@ def doebuild_environment(myebuild, mydo, myroot, mysettings, debug, use_cache, m
mycolors = []
for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET"):
mycolors.append("%s=$'%s'" % \
- (c, portage.output.map_code_to_color_code(c)))
+ (c, portage.output.style_to_ansi_code(c)))
mysettings["PORTAGE_COLORMAP"] = "\n".join(mycolors)
def prepare_build_dirs(myroot, mysettings, cleanup):
diff --git a/pym/portage/output.py b/pym/portage/output.py
index a32a6e714..39359b87f 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -26,7 +26,7 @@ havecolor=1
dotitles=1
codes = {}
-"""Maps color class to tuple of attribute names."""
+"""Maps style class to tuple of attribute names."""
color_codes = {}
"""Maps attribute name to ansi code."""
@@ -290,9 +290,16 @@ def nocolor():
def resetColor():
return color_codes["reset"]
-def map_code_to_color_code(code):
+def style_to_ansi_code(style):
+ """
+ @param style: A style name
+ @type style: String
+ @rtype: String
+ @return: A string containing one or more ansi escape codes that are
+ used to render the given style.
+ """
ret = ""
- for color_code in codes[code]:
+ for color_code in codes[style]:
# allow stuff that has found it's way through ansi_code_pattern
ret += color_codes.get(color_code, color_code)
return ret
@@ -303,7 +310,7 @@ def colorize(color_key, text):
if color_key in color_codes:
return color_codes[color_key] + text + color_codes["reset"]
elif color_key in codes:
- return map_code_to_color_code(color_key) + text + color_codes["reset"]
+ return style_to_ansi_code(color_key) + text + color_codes["reset"]
else:
return text
else:
@@ -342,7 +349,7 @@ class ConsoleStyleFile(object):
global havecolor
if havecolor and self._styles:
for style in self._styles:
- self._file.write(map_code_to_color_code(style))
+ self._file.write(style_to_ansi_code(style))
self._file.write(s)
self._file.write(color_codes["reset"])
else: