[Git][security-tracker-team/security-tracker][master] 4 commits: bin/lts-cve-triage.py: Move to Python 3

Chris Lamb lamby at debian.org
Mon Aug 5 09:26:19 BST 2019



Chris Lamb pushed to branch master at Debian Security Tracker / security-tracker


Commits:
020ae58b by Chris Lamb at 2019-08-05T08:25:43Z
bin/lts-cve-triage.py: Move to Python 3

- - - - -
6f686477 by Chris Lamb at 2019-08-05T08:25:43Z
bin/lts-cve-triage.py: Drop unnecessary "pass" statement

- - - - -
76f08cc1 by Chris Lamb at 2019-08-05T08:25:43Z
bin/lts-cve-triage.py: Print notice to standard error, not stdout

- - - - -
28db1e4b by Chris Lamb at 2019-08-05T08:25:43Z
bin/lts-cve-triage.py: Fix flake8 (3.7.8-3) warnings

- - - - -


1 changed file:

- bin/lts-cve-triage.py


Changes:

=====================================
bin/lts-cve-triage.py
=====================================
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 
 # Copyright 2015 Raphael Hertzog <hertzog at debian.org>
 #
@@ -22,17 +22,18 @@ import collections
 from tracker_data import TrackerData, RELEASES
 from unsupported_packages import UnsupportedPackages, LimitedSupportPackages
 
-def colored(x, *args, **kwargs):
-    return x
-colored_on = False
 
 try:
     if sys.stdout.isatty():
-        from termcolor import colored
+        from termcolor import colored  # noqa
         colored_on = True
 except ImportError:
-    print("Note: you can install python-termcolor for colored output")
-    pass
+    print("Note: you can install python3-termcolor for colored output",
+          file=sys.stderr)
+    colored_on = False
+
+    def colored(x, *args, **kwargs):
+        return x
 
 TRACKER_URL = 'https://security-tracker.debian.org/tracker/'
 
@@ -42,28 +43,27 @@ LIST_NAMES = (
     ('triage_limited_support',
      'Issues on packages with limited support (review support rules)'),
     ('triage_already_in_dsa_needed',
-     ('Issues to triage for {lts} that are already in dsa-needed'
-     ).format(**RELEASES)),
+     ('Issues to triage for {lts} that are already in dsa-needed')
+     .format(**RELEASES)),
     ('triage_likely_nodsa',
-     ('Issues to triage for {lts} that are no-dsa in {next_lts}'
-     ).format(**RELEASES)),
+     ('Issues to triage for {lts} that are no-dsa in {next_lts}')
+     .format(**RELEASES)),
     ('triage_possible_easy_fixes',
-     ('Issues not yet triaged for {lts}, but already fixed in {next_lts}'
-     ).format(**RELEASES)),
+     ('Issues not yet triaged for {lts}, but already fixed in {next_lts}')
+     .format(**RELEASES)),
     ('triage_other_not_triaged_in_next_lts',
-     ('Other issues to triage for {lts} (not yet triaged for {next_lts})'
-     ).format(**RELEASES)),
+     ('Other issues to triage for {lts} (not yet triaged for {next_lts})')
+     .format(**RELEASES)),
     ('triage_other',
      'Other issues to triage (no special status)'),
     ('unexpected_nodsa',
-     ('Issues tagged no-dsa in {lts} that are open in {next_lts}'
-     ).format(**RELEASES)),
+     ('Issues tagged no-dsa in {lts} that are open in {next_lts}')
+     .format(**RELEASES)),
     ('possible_easy_fixes',
-     ('Issues from dla-needed.txt that are already fixed in {next_lts}'
-     ).format(**RELEASES)),
+     ('Issues from dla-needed.txt that are already fixed in {next_lts}')
+     .format(**RELEASES)),
     ('undetermined',
-     ('Undetermined issues in {lts}'
-     ).format(**RELEASES)),
+     ('Undetermined issues in {lts}').format(**RELEASES)),
 )
 
 lists = collections.defaultdict(lambda: collections.defaultdict(lambda: []))
@@ -81,7 +81,8 @@ parser.add_argument('--exclude', nargs='+', choices=[x[0] for x in LIST_NAMES],
 args = parser.parse_args()
 
 tracker = TrackerData(update_cache=not args.skip_cache_update)
-unsupported = UnsupportedPackages(debian_version=8, update_cache=not args.skip_cache_update)
+unsupported = UnsupportedPackages(debian_version=8,
+                                  update_cache=not args.skip_cache_update)
 limited = LimitedSupportPackages(update_cache=not args.skip_cache_update)
 
 
@@ -161,6 +162,12 @@ for key, desc in LIST_NAMES:
         ))
         for x in sorted(lists[key][pkg], key=lambda x: x.name):
             url = '{}{}'.format(TRACKER_URL, x.name)
-            print('  - {:<16s}  {} {}'.format(x.name, colored(url, 'blue'), (key == 'unexpected_nodsa' and x.data['releases'][RELEASES['lts']]['nodsa_reason'] or '')))
+            print('  - {:<16s}  {} {}'.format(
+                x.name,
+                colored(url, 'blue'),
+                (key == 'unexpected_nodsa' and
+                    x.data['releases'][RELEASES['lts']]['nodsa_reason']
+                    or '')),
+            )
 
     print('')



View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/compare/886e35adce71da2513866eecab83032d2d8e0d07...28db1e4b6a682304f298aa969d8cfec78968366a

-- 
View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/compare/886e35adce71da2513866eecab83032d2d8e0d07...28db1e4b6a682304f298aa969d8cfec78968366a
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-security-tracker-commits/attachments/20190805/ffd4baa7/attachment-0001.html>


More information about the debian-security-tracker-commits mailing list