Skip to content

More typing annotations for ninjabackend.py#15791

Open
bonzini wants to merge 33 commits intomesonbuild:masterfrom
bonzini:mypy-ninja-pt2
Open

More typing annotations for ninjabackend.py#15791
bonzini wants to merge 33 commits intomesonbuild:masterfrom
bonzini:mypy-ninja-pt2

Conversation

@bonzini
Copy link
Copy Markdown
Contributor

@bonzini bonzini commented May 8, 2026

Down to 50 errors.

dcbaker and others added 21 commits May 8, 2026 19:41
There's still some additional issues, but, this reduces some of the low
hanging issues. Also, uses a TypeAlias for the Literal to avoid
duplication
This allows each child instance to override 'auto' for itself, without
the parent knowing about them
These extract BothLibraries essentially, but need different logic for
link_with and link_whole, as the latter cannot have shared_libraries or
executables (generally).
This allows mypy to realize that `get` will not in fact return an
invalid type.
The problem with list is invariance. These also don't suffer from the
string problem, so we don't have to deal with the str == Iterable[str]
problem.
Files and ExtractedObjects are also not valid.
The typing is quite complex, but seems to work. This also helps resolve
the fact that Executable's are actually linkable on Windows (and
required in some cases) at this level.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This fixes some complaints from mypy about extra being (possibly)
passed via both **options and the explicit keyword arguments.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
…ra_rpaths

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
@bonzini bonzini changed the title Mypy ninja pt2 More typing annotations for ninjabackend.py May 8, 2026
@bonzini bonzini marked this pull request as ready for review May 8, 2026 17:46
@bonzini bonzini requested review from dcbaker and jpakkane as code owners May 8, 2026 17:46
bonzini added 2 commits May 8, 2026 20:11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added 10 commits May 8, 2026 20:11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Just enough to stop mypy from reporting errors about Any.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Fix

mesonbuild/backend/ninjabackend.py:1822:33: error: "BuildTarget" has no attribute "get"  [attr-defined]

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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.

2 participants