Skip to content
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

Fix build error when frozen modules are updated #8633

Merged
merged 1 commit into from
Nov 18, 2023

Conversation

jepler
Copy link
Member

@jepler jepler commented Nov 18, 2023

When a frozen module was added or updated, a build error would occur during CI: KeyError: 'FROZEN_MPY_DIRS'.

In e40abda I decided that it should be an error if all the expected keys were not defined in the board settings dict. I made this change and all seemed to be well; however, my testing did not exercise the case that a frozen module was changed.

It turns out that FROZEN_MPY_DIRS was not being set in the board settings dict because the output of print-FROZEN_MPY_DIRS was "FROZEN_MPY_DIRS =" (which does not match the regular expression) instead of "FROZEN_MPY_DIRS = " (with a trailing space).

This change fixes the problem by ensuring that an undefined or empty variable still prints with a space character after the equal character.

Tested by running locally:

tools/ci_set_matrix.py frozen/Adafruit_CircuitPython_asyncio

(prints a blank line, expected)

as well as simulating a change to the asyncio frozen submodule:

python3 -c 'import shared_bindings_matrix; print(shared_bindings_matrix.get_settings_from_makefile("ports/atmel-samd", "trinket_m0")["FROZEN_MPY_DIRS"])'

(which will build the elecfreaks_picoed board)

When a frozen module was added or updated, a build error would occur
during CI: `KeyError: 'FROZEN_MPY_DIRS'`.

In e40abda I decided that it should be an error if all the expected
keys were not defined in the board settings dict. I made this change
and all seemed to be well; however, my testing did not exercise the
case that a frozen module was changed.

It turns out that FROZEN_MPY_DIRS was not being set in the board settings
dict because the output of print-FROZEN_MPY_DIRS was "FROZEN_MPY_DIRS ="
(which does not match the regular expression) instead of
"FROZEN_MPY_DIRS = " (with a trailing space).

This change fixes the problem by ensuring that an undefined or empty
variable still prints with a space character after the equal character.

Tested by running locally:
```
python3 -c 'import shared_bindings_matrix; print(shared_bindings_matrix.get_settings_from_makefile("ports/atmel-samd", "trinket_m0")["FROZEN_MPY_DIRS"])'
```
(prints a blank line, expected)

as well as simulating a change to the asyncio frozen submodule:
```
python3 -c 'import shared_bindings_matrix; print(shared_bindings_matrix.get_settings_from_makefile("ports/atmel-samd", "trinket_m0")["FROZEN_MPY_DIRS"])'
```
(which will build the elecfreaks_picoed board)
@jepler jepler requested a review from dhalbert November 18, 2023 15:45
@jepler
Copy link
Member Author

jepler commented Nov 18, 2023

ping @bill88t -- if your git knowledge is up to it, you could merge this into your #8623 and see if it fixes the build error you encountered.

Copy link

@bill88t bill88t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indeed fixes the issue. Many thanks for the quick fix!

Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the diagnosis and thanks @bill88t for testing.

@dhalbert dhalbert merged commit 1374a15 into adafruit:main Nov 18, 2023
470 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants