nrf: Change all boards to use "nrf" for sys.platform value. by dpgeorge · Pull Request #19135 · micropython/micropython · GitHub
Skip to content

nrf: Change all boards to use "nrf" for sys.platform value.#19135

Open
dpgeorge wants to merge 1 commit intomicropython:masterfrom
dpgeorge:nrf-sys-platform-unify
Open

nrf: Change all boards to use "nrf" for sys.platform value.#19135
dpgeorge wants to merge 1 commit intomicropython:masterfrom
dpgeorge:nrf-sys-platform-unify

Conversation

@dpgeorge
Copy link
Copy Markdown
Member

Summary

The sys.platform variable on bare-metal ports is uniformly the port name (except for stm32 which uses "pyboard" for sys.platform), regardless of the board.

Change the nrf port to follow this convention.

Among other things, this gets the test auto-detection working properly on nrf boards, which relies on the value of sys.platform (eg for target wiring selection).

Testing

Tested on PCA10059, it now returns "nrf" for sys.platform.

Also, running ./run-tests -t a0 extmod/machine_s*.py it now correctly detects the nrf port and uses the correct target wiring script (prior, it would just fail tests using target wiring with an ImportError for targe_wiring.py).

Trade-offs and Alternatives

This is a breaking change for the affected nrf boards, because it changes sys.platform on them. But I doubt it's being used much and it should be easy enough to fix relevant Python code.

This change will be prominently noted in the next release notes.

Generative AI

I did not use generative AI tools when creating this PR.

The `sys.platform` variable on bare-metal ports is uniformly the port name
(except for stm32 which uses "pyboard" for `sys.platform`), regardless of
the board.

Change the nrf port to follow this convention.

Among other things, this gets the test auto-detection working properly on
nrf boards, which relies on the value of `sys.platform` (eg for target
wiring selection).

Signed-off-by: Damien George <damien@micropython.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant