validate:tools: Add an option to desativate ANSI colors
authorThibault Saunier <thibault.saunier@collabora.com>
Fri, 10 Jan 2014 09:27:25 +0000 (10:27 +0100)
committerThibault Saunier <thibault.saunier@collabora.com>
Thu, 6 Feb 2014 11:02:58 +0000 (12:02 +0100)
And enhance some debugging output

validate/tools/launcher/baseclasses.py
validate/tools/launcher/main.py
validate/tools/launcher/utils.py

index 5281d11cf2263eb375552bba66429302600f9e7e..e72562e4644b68b14c3a097cb2ff51f42136ee90 100644 (file)
@@ -313,7 +313,8 @@ class _TestsLauncher(Loggable):
             if tester.init() is True:
                 self.testers.append(tester)
             else:
-                self.warning("Can not init tester: %s", tester.name)
+                self.warning("Can not init tester: %s -- PATH is %s"
+                             % (tester.name, os.environ["PATH"]))
 
     def add_options(self, parser):
         for tester in self.testers:
index 112fa7d57a00ab2649f1e7ec457588076853db1a..ccc9384b7b2df5fa769fefa5886c2ab73407b22c 100644 (file)
@@ -17,6 +17,7 @@
 # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 import os
+import utils
 import urlparse
 import loggable
 from optparse import OptionParser
@@ -67,6 +68,9 @@ def main():
                      default=None,
                      help="Set the path to which projects should be"
                      " renderd")
+    parser.add_option("-n", "--no-color", dest="no_color",
+                     action="store_true", default=False,
+                     help="Set it to output no colored text in the terminal")
     loggable.init("GST_VALIDATE_LAUNCHER_DEBUG", True, False)
 
     tests_launcher = _TestsLauncher()
@@ -78,6 +82,9 @@ def main():
         options.dest = os.path.join(options.logsdir, "rendered")
     if urlparse.urlparse(options.dest).scheme == "":
         options.dest = path2url(options.dest)
+    if options.no_color:
+        utils.desactivate_colors()
+
     tests_launcher.set_settings(options, args)
 
     if options.list_tests:
index ba80995b957c6478c3a240d2babef2df0489f14d..43bba25ea67719491d048b60ce49f58e64035b77 100644 (file)
@@ -48,7 +48,7 @@ class Colors(object):
     ENDC = '\033[0m'
 
 
-def desactivate_colors(self):
+def desactivate_colors():
     Colors.HEADER = ''
     Colors.OKBLUE = ''
     Colors.OKGREEN = ''