1
1
import json
2
2
import logging
3
+ from email .parser import Parser
3
4
from optparse import Values
4
5
from typing import TYPE_CHECKING , Generator , List , Optional , Sequence , Tuple , cast
5
6
@@ -323,17 +324,29 @@ def format_for_columns(
323
324
if running_outdated :
324
325
header .extend (["Latest" , "Type" ])
325
326
326
- has_editables = any (x .editable for x in pkgs )
327
- if has_editables :
328
- header .append ("Editable project location" )
327
+ def wheel_build_tag (dist : BaseDistribution ) -> Optional [str ]:
328
+ try :
329
+ wheel_file = dist .read_text ("WHEEL" )
330
+ except FileNotFoundError :
331
+ return None
332
+ return Parser ().parsestr (wheel_file ).get ("Build" )
333
+
334
+ build_tags = [wheel_build_tag (p ) for p in pkgs ]
335
+ has_build_tags = any (build_tags )
336
+ if has_build_tags :
337
+ header .append ("Build" )
329
338
330
339
if options .verbose >= 1 :
331
340
header .append ("Location" )
332
341
if options .verbose >= 1 :
333
342
header .append ("Installer" )
334
343
344
+ has_editables = any (x .editable for x in pkgs )
345
+ if has_editables :
346
+ header .append ("Editable project location" )
347
+
335
348
data = []
336
- for proj in pkgs :
349
+ for i , proj in enumerate ( pkgs ) :
337
350
# if we're working on the 'outdated' list, separate out the
338
351
# latest_version and type
339
352
row = [proj .raw_name , proj .raw_version ]
@@ -342,6 +355,9 @@ def format_for_columns(
342
355
row .append (str (proj .latest_version ))
343
356
row .append (proj .latest_filetype )
344
357
358
+ if has_build_tags :
359
+ row .append (build_tags [i ] or "" )
360
+
345
361
if has_editables :
346
362
row .append (proj .editable_project_location or "" )
347
363
0 commit comments