Sylvain Beucler pushed to branch master at Debian Security Tracker / 
security-tracker


Commits:
ce25ec76 by Sylvain Beucler at 2026-07-13T09:55:17+02:00
bin/lts-cve-triage.py: leave tty detection to python3-termcolor

This allows for:
$ FORCE_COLOR=1 bin/lts-cve-triage.py | less -R

- - - - -
900fcc3d by Sylvain Beucler at 2026-07-13T10:26:06+02:00
bin/lts-cve-triage.py: simplify output code

No output changes. Less format() calls for trivial cases. Drop colored_on 
variable.

- - - - -


1 changed file:

- bin/lts-cve-triage.py


Changes:

=====================================
bin/lts-cve-triage.py
=====================================
@@ -43,20 +43,14 @@ supported_releases = config.get_supported_releases()
 all_releases = config.get_all_releases()
 RELEASES = {}
 
-def colored(x, *args, **kwargs):
-    return x
-
-
-colored_on = False
-
 
 try:
-    if sys.stdout.isatty():
-        from termcolor import colored  # noqa
-        colored_on = True
+    from termcolor import colored  # noqa
 except ImportError:
     print("Note: you can install python3-termcolor for colored output",
           file=sys.stderr)
+    def colored(x, *args, **kwargs):
+        return x
 
 
 # Display links to ELTS' tracker URL which has more dists,
@@ -244,22 +238,23 @@ for pkg in tracker_elts.iterate_packages():
             add_to_list('from_elts', pkg, issue, annotation)
 
 
-for key, desc in LIST_NAMES:
+for key, header in LIST_NAMES:
     if args.filter is not None and key not in args.filter:
         continue
     if args.exclude is not None and key in args.exclude:
         continue
     if not len(lists[key]):
         continue
-    print('\n{}:'.format(colored(desc, attrs=('bold',))))
+    print()
+    print(colored(header, attrs=('bold',)) + ':')
     for pkg in sorted(lists[key].keys()):
-        formatstring = '\n* {:<18s}  {}'
-        if colored_on:
-            formatstring = '\n* {:<35s}  {}'
-        print(formatstring.format(
-            colored(pkg, 'red', attrs=('bold', 'underline')),
-            colored('{}source-package/{}'.format(TRACKER_LINK_URL, pkg), 
'blue'),
-        ))
+        print()
+        alignment = 18 - len(pkg)
+        print('*',
+              colored(pkg, 'red', attrs=('bold', 'underline')),
+              ' ' * alignment,
+              colored(TRACKER_LINK_URL + 'source-package/' + pkg, 'blue'),
+        )
         nb_issues = 0
         versionrsort = functools.cmp_to_key(lambda a, b: 
version_compare(b[0].name, a[0].name))
         for (cve, annotation) in sorted(lists[key][pkg], key=versionrsort):
@@ -268,10 +263,10 @@ for key, desc in LIST_NAMES:
             if nb_issues > 10:
                 print('  - ...')
                 break
-            url = '{}{}'.format(TRACKER_LINK_URL, cve.name)
-            print('  - {:<16s}  {} {}'.format(
+            url = TRACKER_LINK_URL + cve.name
+            print('  - {:16s}  {} {}'.format(
                 cve.name,
                 colored(url, 'blue'),
                 annotation)
             )
-    print('')
+    print()



View it on GitLab: 
https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/02ed90d479a516d5d19e47c921576414884f8c3b...900fcc3de979c54f31c199cd37d50beb9c7a873c

-- 
View it on GitLab: 
https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/02ed90d479a516d5d19e47c921576414884f8c3b...900fcc3de979c54f31c199cd37d50beb9c7a873c
You're receiving this email because of your account on salsa.debian.org. Manage 
all notifications: https://salsa.debian.org/-/profile/notifications | Help: 
https://salsa.debian.org/help


_______________________________________________
debian-security-tracker-commits mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-security-tracker-commits

Reply via email to