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

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon May 18 15:08:03 UTC 2009


Module: Mesa
Branch: gallium-0.1
Commit: 0ed1362268eb9fea0bbcd4434fbc35275a4f55ba
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ed1362268eb9fea0bbcd4434fbc35275a4f55ba

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