summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-11-01 23:55:29 +0000
committerZac Medico <zmedico@gentoo.org>2006-11-01 23:55:29 +0000
commitfffe4a8f8fb082db1b211aad2402003622ba3cfc (patch)
treee785e0b02270a8a3b63fda5c7e6eb0be4d8845dd /pym/output.py
parentFor bug #116616, only run the post_process phase if necessary. (diff)
downloadportage-idfetch-fffe4a8f8fb082db1b211aad2402003622ba3cfc.tar.gz
portage-idfetch-fffe4a8f8fb082db1b211aad2402003622ba3cfc.tar.bz2
portage-idfetch-fffe4a8f8fb082db1b211aad2402003622ba3cfc.zip
Implement --color < y | n > for bug #42115 and deprecate --nocolor. When --color is not specified, rely on the old NOCOLOR variable and/or stdout auto-detection.
svn path=/main/trunk/; revision=4906
Diffstat (limited to 'pym/output.py')
-rw-r--r--pym/output.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pym/output.py b/pym/output.py
index 4ff7ce5f..62ec975f 100644
--- a/pym/output.py
+++ b/pym/output.py
@@ -210,15 +210,18 @@ def notitles():
def nocolor():
"turn off colorization"
+ global havecolor
havecolor=0
- for x in codes.keys():
- codes[x]=""
def resetColor():
return codes["reset"]
def colorize(color_key, text):
- return codes[color_key] + text + codes["reset"]
+ global havecolor
+ if havecolor:
+ return codes[color_key] + text + codes["reset"]
+ else:
+ return text
compat_functions_colors = ["bold","white","teal","turquoise","darkteal",
"fuscia","fuchsia","purple","blue","darkblue","green","darkgreen","yellow",