summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-07-04 11:48:57 +0000
committerZac Medico <zmedico@gentoo.org>2007-07-04 11:48:57 +0000
commit60a4ff083107c12bafbe9ce7e48ce3070e5f8d7d (patch)
tree68a2460f1c21bbe7fec721e3abb805fd3fddea1f
parentac97fcba49c9571ced5984a1aea82f8498c1b098 (diff)
downloadportage-60a4ff083107c12bafbe9ce7e48ce3070e5f8d7d.tar.gz
portage-60a4ff083107c12bafbe9ce7e48ce3070e5f8d7d.tar.bz2
portage-60a4ff083107c12bafbe9ce7e48ce3070e5f8d7d.zip
For bug #183861, allow a color class in color.map to specify a space separated list of attributes so that any combination of foreground, background, and other attributes is possible. Thanks to Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA@GMail.Com> for this patch.
svn path=/main/trunk/; revision=7146
-rw-r--r--pym/portage/output.py50
1 files changed, 34 insertions, 16 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py
index 2f64eaf60..fabfb4bdb 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -73,6 +73,7 @@ codes["standout"] = esc_seq + "03m"
codes["underline"] = esc_seq + "04m"
codes["blink"] = esc_seq + "05m"
codes["overline"] = esc_seq + "06m" # Who made this up? Seriously.
+codes["reverse"] = esc_seq + "07m"
ansi_color_codes = []
for x in xrange(30, 38):
@@ -119,6 +120,15 @@ codes["darkyellow"] = codes["0xAAAA00"]
codes["fuscia"] = codes["fuchsia"]
codes["white"] = codes["bold"]
+codes["bg_black"] = esc_seq + "40m"
+codes["bg_red"] = esc_seq + "41m"
+codes["bg_green"] = esc_seq + "42m"
+codes["bg_brown"] = esc_seq + "43m"
+codes["bg_blue"] = esc_seq + "44m"
+codes["bg_magenta"] = esc_seq + "45m"
+codes["bg_cyan"] = esc_seq + "46m"
+codes["bg_white"] = esc_seq + "47m"
+
# Colors from /sbin/functions.sh
codes["GOOD"] = codes["green"]
codes["WARN"] = codes["yellow"]
@@ -127,18 +137,22 @@ codes["HILITE"] = codes["teal"]
codes["BRACKET"] = codes["blue"]
# Portage functions
-codes["INFORM"] = codes["darkgreen"]
-codes["UNMERGE_WARN"] = codes["red"]
-codes["SECURITY_WARN"] = codes["red"]
-codes["MERGE_LIST_PROGRESS"] = codes["yellow"]
-codes["PKG_MERGE"] = codes["darkgreen"]
-codes["PKG_MERGE_ARG"] = codes["darkgreen"]
-codes["PKG_MERGE_SYSTEM"] = codes["green"]
-codes["PKG_MERGE_WORLD"] = codes["green"]
-codes["PKG_NOMERGE"] = codes["darkblue"]
-codes["PKG_NOMERGE_ARG"] = codes["darkblue"]
-codes["PKG_NOMERGE_SYSTEM"] = codes["blue"]
-codes["PKG_NOMERGE_WORLD"] = codes["blue"]
+codes["INFORM"] = codes["darkgreen"]
+codes["UNMERGE_WARN"] = codes["red"]
+codes["SECURITY_WARN"] = codes["red"]
+codes["MERGE_LIST_PROGRESS"] = codes["yellow"]
+codes["PKG_MERGE"] = codes["darkgreen"]
+codes["PKG_MERGE_ARG"] = codes["darkgreen"]
+codes["PKG_MERGE_SYSTEM"] = codes["green"]
+codes["PKG_MERGE_WORLD"] = codes["green"]
+codes["PKG_MERGE_ARG_SYSTEM"] = codes["green"]
+codes["PKG_MERGE_ARG_WORLD"] = codes["green"]
+codes["PKG_NOMERGE"] = codes["darkblue"]
+codes["PKG_NOMERGE_ARG"] = codes["darkblue"]
+codes["PKG_NOMERGE_SYSTEM"] = codes["blue"]
+codes["PKG_NOMERGE_WORLD"] = codes["blue"]
+codes["PKG_NOMERGE_ARG_SYSTEM"] = codes["blue"]
+codes["PKG_NOMERGE_ARG_WORLD"] = codes["blue"]
def parse_color_map():
myfile = COLOR_MAP_FILE
@@ -159,13 +173,17 @@ def parse_color_map():
raise ParseError("%s%s'%s'" % (s.error_leader(myfile, s.lineno), "expected '=' operator: ", o))
k = strip_quotes(k, s.quotes)
v = strip_quotes(v, s.quotes)
+ if not k in codes:
+ print ParseError("%s%s'%s'" % (s.error_leader(myfile, s.lineno), "Unknown variable: ", k))
+ continue
if ansi_code_pattern.match(v):
codes[k] = esc_seq + v
else:
- if v in codes:
- codes[k] = codes[v]
- else:
- raise ParseError("%s%s'%s'" % (s.error_leader(myfile, s.lineno), "Undefined: ", v))
+ for x in v.split(" "):
+ if x in codes:
+ codes[k] = codes[k] + codes[x]
+ else:
+ print ParseError("%s%s'%s'" % (s.error_leader(myfile, s.lineno), "Undefined: ", x))
except (IOError, OSError), e:
if e.errno == errno.ENOENT:
raise FileNotFound(myfile)