-
Notifications
You must be signed in to change notification settings - Fork 7.7k
scripts: sort boards alphabetically #89483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hello @Jyx, and thank you very much for your first pull request to the Zephyr project! |
It's not entirely true what you're claiming. You now have 2 sorted lists appended, first v1 boards, and then v2 boards. Not sure if this is a big concern, but this might be equally confusing as non-sorted boards. |
Ah, you're right, I just realized that with the setup I have, I get no outputs from the v1 boards. I.e., it's only the second loop that produces output.
Yes maybe, but what about printing "v1-boards" before running the first loop and then "v2-boards" before running the second loop? Then you at least have separation and you still get each section sorted. I.e., something like this: $ git diff
diff --git a/scripts/west_commands/boards.py b/scripts/west_commands/boards.py
index 9668c53b407..bcb1a69e8c5 100644
--- a/scripts/west_commands/boards.py
+++ b/scripts/west_commands/boards.py
@@ -92,6 +92,7 @@ class Boards(WestCommand):
args.board_roots += module_settings['board_root']
args.soc_roots += module_settings['soc_root']
+ print("v1-boards\n=========")
for board in sorted(list_boards.find_boards(args),
key=lambda b: b.name):
if name_re is not None and not name_re.search(board.name):
@@ -107,6 +108,7 @@ class Boards(WestCommand):
revisions=revisions_list,
dir=board.dir, hwm=board.hwm, qualifiers=''))
+ print("v2-boards\n=========")
for board in sorted(list_boards.find_v2_boards(args).values(),
key=lambda b: b.name):
if name_re is not None and not name_re.search(board.name): That would produce this
Would that be good and acceptable? |
Don't use print, and I think we need to consider that the output could be redirected to other scripts, so I'd rather not add those. If anything is printed extra, it should be done with debug. But as V1 boards are deprecated, I'm not sure we should even bother. |
Got it!
Let me try to fix |
Sort the output alphabetically when executing 'west boards'. Doing so makes it simpler to locate boards while scrolling through the list of all accessible boards. This method is compatible with the '-n' argument too, which also will result in a filtered and sorted list. Signed-off-by: Joakim Bech <joakim.bech@gmail.com>
@pdgendt please let me know if this is more inline with what you were looking for. I've been running the tests locally (had to add |
I haven't looked at the changes in details but changing the signature of the find_v2_boards() API is asking for trouble. For example, this breaks documentation generation (see https://github.com/jyx/zephyr/blob/f3caf3c0a8234f47a088fee6da52858a3672ed13/doc/_scripts/gen_boards_catalog.py#L264), which CI will likely confirm in a minute. |
Thanks, as I see these changes required, I'm a bit concerned about changing the return type of this "public" function |
Could this sort based on the formatted output? then you'd have it by vendor if you use |
Sort the output alphabetically when executing 'west boards'. Doing so makes it simpler to locate boards while scrolling through the list of all accessible boards. This method is compatible with the '-n' argument too, which also will result in a filtered and sorted list.