Skip to content

Commit 4ee4257

Browse files
committed
[nrf fromtree] scripts: list_boards: Reintroduce Board.dir as @Property
In the `Board` class, the `dir` member was renamed to `directories`, both to indicate that it is now a list (in HWMv2 with board extensions) and to reflect the addition of the `BOARD_DIRECTORIES` CMake variable. Considering that the build system also keeps the `BOARD_DIR` variable, and for the sake of backwards compatibility and brevity, it should be useful to retain `Board.dir` in Python as well, symmetrically. Signed-off-by: Grzegorz Swiderski <[email protected]> (cherry picked from commit a1f3f88)
1 parent 39cdb7f commit 4ee4257

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/list_boards.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ class Board:
104104
socs: List[Soc] = field(default_factory=list, compare=False)
105105
variants: List[str] = field(default_factory=list, compare=False)
106106

107+
@property
108+
def dir(self):
109+
# Get the main board directory.
110+
if isinstance(self.directories, Path):
111+
return self.directories
112+
return self.directories[0]
113+
107114
def from_qualifier(self, qualifiers):
108115
qualifiers_list = qualifiers.split('/')
109116

0 commit comments

Comments
 (0)