Skip to content

Build layer typing fixes, part 2#15786

Open
dcbaker wants to merge 16 commits intomesonbuild:masterfrom
dcbaker:submit/build-layer-typing-part2
Open

Build layer typing fixes, part 2#15786
dcbaker wants to merge 16 commits intomesonbuild:masterfrom
dcbaker:submit/build-layer-typing-part2

Conversation

@dcbaker
Copy link
Copy Markdown
Member

@dcbaker dcbaker commented May 7, 2026

This is the second piece of the series (cut roughly into thirds), to get the build.py layer mypy safe. With this series we're down to just 14 issues in build.py. I have the remaining patches to get us there in a branch, but wanted to continue to break this up to make review eaiser

dcbaker added 9 commits May 7, 2026 12:47
This makes the typing clearer, and avoids the need for a base class
which adds effectively a private method.
This makes copying with types much easier than open coding this
elsewhere.
This fixes some typing issues, as well as being more generically
correct.
This makes it match BuildTarget, and removes another use of strings as
sources below the Interpreter.
Mypy should cover internal use cases, and the interpreter is fully typed
now.
This removes some dead or should-be-dead code, mostly validation.
@dcbaker dcbaker requested a review from jpakkane as a code owner May 7, 2026 19:54
@dcbaker dcbaker added the typing label May 7, 2026
dcbaker added 7 commits May 7, 2026 12:57
mypy can't tell that the `if preserve_path_from:` in the final inner
loop will not be true for the GeneratedList case. We can avoid that case
anyway, just add the files early and continue.
So that it can fulfill interface contracts.
…llback

I don't understand why the one works but not the other with mypy and
pylance, but it does
Again, we don't have strings, so it's perfectly safe to use iterable
here, and we avoid the constant need to cast
@dcbaker dcbaker force-pushed the submit/build-layer-typing-part2 branch from 39a4d22 to 29f0582 Compare May 7, 2026 19:57
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