Skip to content

Conversation

decsny
Copy link
Member

@decsny decsny commented Oct 8, 2025

Refactor build/runner scripts to not use the deprecated west logging API to stop the dozens of python warnings that happen when running west build and west flash or west whatever.

Fixes #92475

This all has to be one commit because of all the coupling of dependencies across these scripts, it would not be bisectable any other way.

@decsny decsny changed the title scripts: Refactor build/runner west logging scripts: Refactor build/runner west logging to not use deprecated APIs Oct 8, 2025
@zephyrbot zephyrbot added the area: West West utility label Oct 8, 2025
Refactor build/runner scripts to not use the deprecated west logging API
to stop the dozens of python warnings that happen when running west
build and west flash or west whatever.

Signed-off-by: Declan Snyder <[email protected]>
@decsny decsny force-pushed the fix/west_log_deprecated branch from 93dd1a9 to 61a06d0 Compare October 8, 2025 23:13
Copy link

sonarqubecloud bot commented Oct 8, 2025

@marc-hb
Copy link
Contributor

marc-hb commented Oct 9, 2025

@mbolivar is it really required to add some west_command everywhere now? In every function signature, even the most basic and "static" ones? Adding a self argument is not too bad, but _ensure_min_version(west_command,... ) looks a bit ugly IMHO. Logging is one the most basic feature, it should have very little dependencies :-(

What are the best practice(s)? If any, please add them to zephyrproject-rtos/west#149, thanks!

@pdgendt
Copy link
Contributor

pdgendt commented Oct 9, 2025

Thanks @decsny for doing this! This is a welcome patch in preparation for West v2 where the deprecated log module would be dropped.

@marc-hb we shouldn't rely on a global log state/module IMO, so not sure if there's a better alternative?

@mbolivar
Copy link
Contributor

mbolivar commented Oct 9, 2025

Logging is one the most basic feature, it should have very little dependencies :-(

What are the best practice(s)? If any, please add them to zephyrproject-rtos/west#149, thanks!

@marc-hb is anything missing from here in terms of best practices and rationale?

https://github.com/zephyrproject-rtos/west/blob/594a789d19f2c66c1937210e67bf9e59c2a4387c/src/west/log.py#L6

@marc-hb
Copy link
Contributor

marc-hb commented Oct 9, 2025

@marc-hb is anything missing from here in terms of best practices and rationale?

Yes; a nicer way? :-)

@mbolivar
Copy link
Contributor

mbolivar commented Oct 9, 2025

Not sure what you're asking for, but the successor to the global state in the west.log module is the per-instance state in https://github.com/zephyrproject-rtos/west/blob/594a789d19f2c66c1937210e67bf9e59c2a4387c/src/west/commands.py#L410.

Your objection seems to be about the verbosity of passing a WestCommand instance around instead of implicitly relying on the global state. I guess one potentially 'nicer' way to handle that here would be to reorganize this code to stash the WestCommand in an instance variable inside of a new class instead of using module-level functions. I don't have any other suggestions right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: West West utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zephyr west commands are having lots of warnings

5 participants