2222from apio .utils import util , cmd_util
2323from apio .commands import options
2424from apio .managers .examples import Examples
25+ from apio .common .proto .apio_common_pb2 import ApioArch
2526from apio .apio_context import (
2627 ApioContext ,
2728 PackagesPolicy ,
@@ -36,7 +37,7 @@ class Entry:
3637
3738 # pylint: disable=too-many-instance-attributes
3839
39- board : str
40+ board_id : str
4041 examples_count : str
4142 board_description : str
4243 fpga_arch : str
@@ -47,31 +48,30 @@ class Entry:
4748
4849 def sort_key (self ):
4950 """A key for sorting the fpga entries in our preferred order."""
50- return (util .fpga_arch_sort_key (self .fpga_arch ), self .board .lower ())
51+ return (util .fpga_arch_sort_key (self .fpga_arch ), self .board_id .lower ())
5152
5253
53- def _collect_board_entries (apio_ctx ) -> List [Entry ]:
54+ def _collect_board_entries (apio_ctx : ApioContext ) -> List [Entry ]:
5455
5556 # -- Get examples counts by board. This is a sparse dictionary.
5657 examples = Examples (apio_ctx )
5758 examples_counts : Dict [str , int ] = examples .count_examples_by_board ()
5859
5960 # -- Collect the boards info into a list of entires, one per board.
6061 result : List [Entry ] = []
61- for board , board_definition in apio_ctx .definitions .boards .items ():
62+ for board_id , board_definition in apio_ctx .definitions .boards .items ():
6263 fpga_id = board_definition .fpga_id
63- fpga_info = apio_ctx .definitions .fpgas .get (fpga_id , {})
64-
65- examples_count = " " + str (examples_counts .get (board , "" ))
64+ fpga_definition = apio_ctx .definitions .fpgas [fpga_id ]
65+ examples_count = " " + str (examples_counts .get (board_id , "" ))
6666 board_description = board_definition .description
67- fpga_arch = fpga_info . get ( " arch" , "" )
68- fpga_size = fpga_info . get ( " size" , "" )
69- fpga_part_num = fpga_info . get ( "part-num" , "" )
67+ fpga_arch = ApioArch . Name ( fpga_definition . arch )
68+ fpga_size = fpga_definition . size
69+ fpga_part_num = fpga_definition . part_num
7070 programmer_id = board_definition .programmer .id
7171
7272 result .append (
7373 Entry (
74- board = board ,
74+ board_id = board_id ,
7575 examples_count = examples_count ,
7676 board_description = board_description ,
7777 fpga_arch = fpga_arch ,
@@ -127,12 +127,12 @@ def _list_boards(apio_ctx: ApioContext, verbose: bool):
127127
128128 # -- Collect row values.
129129 values = []
130- values .append (entry .board )
130+ values .append (entry .board_id )
131131 values .append (str (entry .examples_count ))
132132 if verbose :
133133 values .append (entry .board_description )
134134 values .append (entry .fpga_arch )
135- values .append (str ( entry .fpga_size ) )
135+ values .append (entry .fpga_size )
136136 if verbose :
137137 values .append (entry .fpga_id )
138138 values .append (entry .fpga_part_num )
@@ -169,7 +169,7 @@ def _list_boards_docs_format(apio_ctx: ApioContext):
169169 entries : List [Entry ] = _collect_board_entries (apio_ctx )
170170
171171 # -- Determine column sizes
172- w1 = max (len ("BOARD" ), * (len (entry .board ) for entry in entries ))
172+ w1 = max (len ("BOARD" ), * (len (entry .board_id ) for entry in entries ))
173173 w2 = max (len ("SIZE" ), * (len (entry .fpga_size ) for entry in entries ))
174174 w3 = max (
175175 len ("DESCRIPTION" ),
@@ -222,7 +222,7 @@ def _list_boards_docs_format(apio_ctx: ApioContext):
222222
223223 cwrite (
224224 "| {0} | {1} | {2} | {3} |\n " .format (
225- entry .board .ljust (w1 ),
225+ entry .board_id .ljust (w1 ),
226226 entry .fpga_size .ljust (w2 ),
227227 entry .board_description .ljust (w3 ),
228228 entry .fpga_part_num .ljust (w4 ),
0 commit comments