Mesa (master): python: Use Ansi escape codes regardless of output is a tty or not.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Mar 25 21:04:24 UTC 2009


Module: Mesa
Branch: master
Commit: 5743483778ffe5b389d10b1651ae1e8951b397ee
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5743483778ffe5b389d10b1651ae1e8951b397ee

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Mar 25 10:22:05 2009 +0000

python: Use Ansi escape codes regardless of output is a tty or not.

---

 .../state_trackers/python/retrace/format.py        |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/gallium/state_trackers/python/retrace/format.py b/src/gallium/state_trackers/python/retrace/format.py
index 0bf6baf..d56d72f 100755
--- a/src/gallium/state_trackers/python/retrace/format.py
+++ b/src/gallium/state_trackers/python/retrace/format.py
@@ -27,6 +27,9 @@
 ##########################################################################
 
 
+import sys
+
+
 class Formatter:
     '''Plain formatter'''
 
@@ -93,7 +96,7 @@ class AnsiFormatter(Formatter):
 
 
 def DefaultFormatter(stream):
-    if stream.isatty():
+    if sys.platform in ('linux2', 'cygwin'):
         return AnsiFormatter(stream)
     else:
         return Formatter(stream)




More information about the mesa-commit mailing list