aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2010-11-17 19:30:43 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2010-11-17 19:30:43 +0000
commitfa48aa33f819a6024d852ce7448d6e75b24ddc78 (patch)
tree3ac1eca3327b5b0fee5161850a136c3427f98997
parentUpdate for new portage. (diff)
downloadrbot-gentoo-fa48aa33f819a6024d852ce7448d6e75b24ddc78.tar.gz
rbot-gentoo-fa48aa33f819a6024d852ce7448d6e75b24ddc78.tar.bz2
rbot-gentoo-fa48aa33f819a6024d852ce7448d6e75b24ddc78.zip
Add nocolor support to earch.
-rw-r--r--gentoo-scripts/earch11
1 files changed, 7 insertions, 4 deletions
diff --git a/gentoo-scripts/earch b/gentoo-scripts/earch
index f18da83..7d72dd2 100644
--- a/gentoo-scripts/earch
+++ b/gentoo-scripts/earch
@@ -27,6 +27,7 @@ def earch_main():
opt_masking_reasons = False
opt_hide_masked = False
opt_category = False
+ opt_nocolor = False
opt_help = False
opt_remove_pkgs = False
opt_one_slot = False
@@ -36,8 +37,10 @@ def earch_main():
opt_slot = []
# process commandline
try:
- (opts,args) = getopt.gnu_getopt(sys.argv[1:],'cfhHims:orv',['category','masking-reasons','help','hide-masked','version','slot=','remove-pkgs','ignore-redundant','follow-etc-portage'])
+ (opts,args) = getopt.gnu_getopt(sys.argv[1:],'CcfhHims:orv',['nocolor','category','masking-reasons','help','hide-masked','version','slot=','remove-pkgs','ignore-redundant','follow-etc-portage'])
for optkey,optvalue in opts:
+ if optkey == '--nocolor':
+ opt_nocolor = True
if optkey == '-c' or optkey == '--category':
opt_category = True
if optkey == '-f' or optkey == '--follow-etc-portage':
@@ -79,7 +82,7 @@ def earch_main():
os.environ["PORTAGE_CALLER"]="repoman"
# generate
- (ebuildlist,ebuilddata,pkgkeywords) = earch_data_generate(args,slots=opt_slot,hide_masked=opt_hide_masked,include_category=opt_category,ignore_redundant=opt_ignore_redundant,one_slot=opt_one_slot)
+ (ebuildlist,ebuilddata,pkgkeywords) = earch_data_generate(args,slots=opt_slot,hide_masked=opt_hide_masked,include_category=opt_category,ignore_redundant=opt_ignore_redundant,one_slot=opt_one_slot,nocolor=opt_nocolor)
if opt_remove_pkgs:
earch_remove_pkgs(ebuildlist,ebuilddata,pkgkeywords)
@@ -148,7 +151,7 @@ def earch_manual_getkeywords(pkg):
file.close
return re.split(" ",keywords)
-def earch_data_generate(args,slots=[],hide_masked=False,include_category=False,ignore_redundant=False,one_slot=False):
+def earch_data_generate(args,slots=[],hide_masked=False,include_category=False,ignore_redundant=False,one_slot=False,nocolor=False):
stderr = sys.stderr
sys.stderr = open('/dev/null', 'w')
import portage
@@ -158,7 +161,7 @@ def earch_data_generate(args,slots=[],hide_masked=False,include_category=False,i
# disable color as needed
# this is actually out of place, but still the best place to run it
# to avoid importing portage twice
- if (not sys.stdout.isatty()) or (portage.settings["NOCOLOR"] in ["yes","true","1"]):
+ if (not sys.stdout.isatty()) or (portage.settings["NOCOLOR"] in ["yes","true","1"] or nocolor):
nocolor()
portdir = portage.settings["PORTDIR"]