summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-01-11 05:22:43 +0000
committerZac Medico <zmedico@gentoo.org>2010-01-11 05:22:43 +0000
commitb4ef1e6be09e5033e165ab1cfe062d23b00f0254 (patch)
tree5563e73c5005ddd91f25bebfb6c510ebeabd4de4
parentTweak TERM usage in xtermTitleReset() to match that in xtermTitle(). (diff)
downloadportage-idfetch-b4ef1e6be09e5033e165ab1cfe062d23b00f0254.tar.gz
portage-idfetch-b4ef1e6be09e5033e165ab1cfe062d23b00f0254.tar.bz2
portage-idfetch-b4ef1e6be09e5033e165ab1cfe062d23b00f0254.zip
Bug #300388 - Fix terminal handling code to so term codes aren't sent when
TERM=dumb. svn path=/main/trunk/; revision=15191
-rwxr-xr-xbin/ebuild1
-rwxr-xr-xbin/emaint2
-rwxr-xr-xbin/repoman1
-rw-r--r--pym/_emerge/JobStatusDisplay.py4
-rw-r--r--pym/_emerge/actions.py9
-rw-r--r--pym/_emerge/main.py4
-rw-r--r--pym/portage/getbinpkg.py2
7 files changed, 16 insertions, 7 deletions
diff --git a/bin/ebuild b/bin/ebuild
index dc3f448c..d8eec06a 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -88,6 +88,7 @@ if debug and "python-trace" in portage.features:
if not opts.color == 'y' and \
(opts.color == 'n' or \
portage.settings.get('NOCOLOR') in ('yes', 'true') or \
+ portage.settings.get('TERM') == 'dumb' or \
not sys.stdout.isatty()):
portage.output.nocolor()
portage.settings.unlock()
diff --git a/bin/emaint b/bin/emaint
index 594ac87c..46129437 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -536,7 +536,7 @@ def emaint_main(myargv):
status = "Attempting to fix %s"
func = "fix"
- isatty = sys.stdout.isatty()
+ isatty = os.environ.get('TERM') != 'dumb' and sys.stdout.isatty()
for task in tasks:
print(status % task.name())
inst = task()
diff --git a/bin/repoman b/bin/repoman
index 679dcae6..2a1ef055 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -96,6 +96,7 @@ repoman_settings = portage.config(local_config=False,
repoman_settings.lock()
if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
+ repoman_settings.get('TERM') == 'dumb' or \
not sys.stdout.isatty():
nocolor()
diff --git a/pym/_emerge/JobStatusDisplay.py b/pym/_emerge/JobStatusDisplay.py
index dfc766d2..83603ed8 100644
--- a/pym/_emerge/JobStatusDisplay.py
+++ b/pym/_emerge/JobStatusDisplay.py
@@ -55,7 +55,9 @@ class JobStatusDisplay(object):
object.__setattr__(self, "_jobs_column_width", width - 32)
self.reset()
- isatty = hasattr(self.out, "isatty") and self.out.isatty()
+ isatty = os.environ.get('TERM') != 'dumb' and \
+ hasattr(self.out, 'isatty') and \
+ self.out.isatty()
object.__setattr__(self, "_isatty", isatty)
if not isatty or not self._init_term():
term_codes = {}
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 1d7fdc68..2def0e89 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -1467,8 +1467,10 @@ def action_metadata(settings, portdb, myopts, porttrees=None):
porttrees = [tree_data.path for tree_data in porttrees_data]
- isatty = sys.stdout.isatty()
- quiet = not isatty or '--quiet' in myopts
+ quiet = settings.get('TERM') == 'dumb' or \
+ '--quiet' in myopts or \
+ not sys.stdout.isatty()
+
onProgress = None
if not quiet:
progressBar = portage.output.TermProgressBar()
@@ -2389,7 +2391,8 @@ def adjust_config(myopts, settings):
portage.output.havecolor = 0
settings["NOCOLOR"] = "true"
settings.backup_changes("NOCOLOR")
- elif not sys.stdout.isatty() and settings.get("NOCOLOR") != "no":
+ elif settings.get('TERM') == 'dumb' or \
+ not sys.stdout.isatty():
portage.output.havecolor = 0
settings["NOCOLOR"] = "true"
settings.backup_changes("NOCOLOR")
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index a2245892..d9916c9d 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1324,7 +1324,9 @@ def emerge_main():
portage.debug.set_trace(True)
if not ("--quiet" in myopts):
- if not sys.stdout.isatty() or ("--nospinner" in myopts):
+ if '--nospinner' in myopts or \
+ settings.get('TERM') == 'dumb' or \
+ not sys.stdout.isatty():
spinner.update = spinner.update_basic
if myaction == 'version':
diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py
index 42938de9..26b2bb1f 100644
--- a/pym/portage/getbinpkg.py
+++ b/pym/portage/getbinpkg.py
@@ -638,7 +638,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
self.out.flush()
cache_stats = CacheStats(out)
- have_tty = out.isatty()
+ have_tty = os.environ.get('TERM') != 'dumb' and out.isatty()
if have_tty:
cache_stats.display()
binpkg_filenames = set()