summaryrefslogtreecommitdiffstats
path: root/bin/emerge
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-01-13 02:54:55 +0000
committerZac Medico <zmedico@gentoo.org>2007-01-13 02:54:55 +0000
commit0d3cfe81db4428faa5a518cd0769006cad1df36b (patch)
tree4a16091b0256ee58a3d06268a0fa7bff16b1c4ef /bin/emerge
parent336a1db43e36be403bd455c185a230203dca98aa (diff)
downloadportage-0d3cfe81db4428faa5a518cd0769006cad1df36b.tar.gz
portage-0d3cfe81db4428faa5a518cd0769006cad1df36b.tar.bz2
portage-0d3cfe81db4428faa5a518cd0769006cad1df36b.zip
For bug #144380, disable color at emerge startup and then enable it only when it's absolutely sure that color should be enabled (after EMERGE_DEFAULT_OPTS has been parsed).
svn path=/main/trunk/; revision=5625
Diffstat (limited to 'bin/emerge')
-rwxr-xr-xbin/emerge21
1 files changed, 7 insertions, 14 deletions
diff --git a/bin/emerge b/bin/emerge
index 408a44a51..d73368b51 100755
--- a/bin/emerge
+++ b/bin/emerge
@@ -4951,6 +4951,9 @@ def adjust_config(myopts, settings):
settings["PORTAGE_DEBUG"] = str(PORTAGE_DEBUG)
settings.backup_changes("PORTAGE_DEBUG")
+ if settings.get("NOCOLOR") not in ("yes","true"):
+ output.havecolor = 1
+
"""The explicit --color < y | n > option overrides the NOCOLOR environment
variable and stdout auto-detection."""
if "--color" in myopts:
@@ -4961,12 +4964,15 @@ def adjust_config(myopts, settings):
output.havecolor = 0
settings["NOCOLOR"] = "true"
settings.backup_changes("NOCOLOR")
- elif not sys.stdout.isatty():
+ elif not sys.stdout.isatty() and settings.get("NOCOLOR") != "no":
output.havecolor = 0
settings["NOCOLOR"] = "true"
settings.backup_changes("NOCOLOR")
def emerge_main():
+ # Disable color until we're sure that it should be enabled (after
+ # EMERGE_DEFAULT_OPTS has been parsed).
+ output.havecolor = 0
# This first pass is just for options that need to be known as early as
# possible, such as --config-root. They will be parsed again later,
# together with EMERGE_DEFAULT_OPTS (which may vary depending on the
@@ -4998,19 +5004,6 @@ def emerge_main():
xterm_titles = "notitles" not in settings.features
- """Disable color as early as possible via NOCOLOR and stdout
- auto-detection. This initial setting may later be overridden via the
- --color < yes | no > option."""
- if settings.get("NOCOLOR","").lower() in ("yes","true"):
- nocolor()
- elif (not sys.stdout.isatty()) and \
- settings.get("NOCOLOR","").lower() != "no":
- # revdep-rebuild exports NOCOLOR=false, so for now, don't allow
- # NOCOLOR=false to override the isatty() check. This can be fixed
- # in revdep-rebuild by using the --nocolor option when appropriate
- # instead of exporting NOCOLOR.
- nocolor()
-
tmpcmdline = []
if "--ignore-default-opts" not in sys.argv:
tmpcmdline.extend(settings["EMERGE_DEFAULT_OPTS"].split())