[Secure-testing-commits] r43989 - bin

Chris Lamb lamby at moszumanska.debian.org
Tue Aug 16 11:13:51 UTC 2016


Author: lamby
Date: 2016-08-16 11:13:51 +0000 (Tue, 16 Aug 2016)
New Revision: 43989

Modified:
   bin/lts-cve-triage.py
Log:
bin/lts-cve-triage.py: Colorise output

Modified: bin/lts-cve-triage.py
===================================================================
--- bin/lts-cve-triage.py	2016-08-16 11:13:50 UTC (rev 43988)
+++ bin/lts-cve-triage.py	2016-08-16 11:13:51 UTC (rev 43989)
@@ -15,12 +15,22 @@
 # You should have received a copy of the GNU General Public License
 # along with this file.  If not, see <https://www.gnu.org/licenses/>.
 
+import sys
 import argparse
 import collections
 
 from tracker_data import TrackerData, RELEASES
 from unsupported_packages import UnsupportedPackages
 
+def colored(x, *args, **kwargs):
+    return x
+
+try:
+    if sys.stdout.isatty():
+        from termcolor import colored
+except ImportError:
+    pass
+
 LIST_NAMES = (
     ('triage_already_in_dsa_needed',
      ('Issues to triage for {lts} that are already in dsa-needed'
@@ -117,9 +127,12 @@
         continue
     if not len(lists[key]):
         continue
-    print('\n{}:'.format(desc))
+    print('\n{}:'.format(colored(desc, attrs=('bold',))))
     for pkg in sorted(lists[key].keys()):
         cve_list = ' '.join(
             [i.name for i in sorted(lists[key][pkg], key=lambda i: i.name)])
-        print('\n* {:20s}\n  {}'.format(pkg, cve_list))
+        print('\n* {:20s}\n  {}'.format(
+            colored(pkg, 'red', attrs=('bold', 'underline')),
+            cve_list,
+        ))
     print('')




More information about the Secure-testing-commits mailing list