summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/run_tool.py
AgeCommit message (Collapse)Author
2025-12-04implement --env-set parameter manually in rustdoc scriptPaolo Bonzini
Rustdoc does not yet support the --env-set parameter, change the environment directly instead. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-31Avoid setting asycnio loop policy if possibleDylan Baker
The entire policy system has been deprecated in Python 3.14, and is slated for removal in 3.16. This has been caught by pylint, and is causing CI to fail. For our use case this is only relevant on Python 3.7 on Windows, as the default policy on 3.8 is set to the Proactor anyway.
2025-09-25mypy: fix typing looseness regression in 3.13Eli Schwartz
glob can be a generator or an iterator depending on python version. We would rather not care about this (and officially these are the same, except not). We just pass it to "accepts_iterable". But nonetheless, we are forced to care because we hold the value. Sad.
2025-07-21clang-tidy: run tool only on source files participating in targetsSahnvour
clang-tidy can't be ran as is on every source file and header
2024-12-19scripts: add "clippy" internal toolPaolo Bonzini
Similar to the "ninja scan-build" target for C, add a clippy internal tool that runs clippy-driver on all crates in the project. The approach used is more efficient than with "ninja scan-build", and does not require rerunning Meson in a separate build directory; it uses the introspection data to find the compiler arguments for the target and invokes clippy-driver with a slightly modified command line. This could actually be applied to scan-build as well, reusing the run_tool_on_targets() function. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19scripts: convert run_tool to asyncioPaolo Bonzini
This improves the handling of keyboard interrupt, and also makes it easy to buffer the output and not mix errors from different subprocesses. This is useful for clang-tidy and will be used by clippy as well. In addition, the new code supports MESON_NUM_PROCESSES. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-12-19scripts: rename run_tool to run_clang_toolPaolo Bonzini
Differentiate from the "run_tool_on_targets" function that will be introduced in the next commit. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-08-25Better handle CTRL-C during clang-tidy/formatMark A. Tsuchida
It was possible (with some frequency) for the clang-tidy/format target to continue starting new subprocesses after a CTRL-C, because we were not canceling the already queued tasks and waiting for all of them. This makes a best-effort attempt to cancel all further subprocesses. It is not 100%, because there is a race that is hard to avoid (without major restructuring, at least): new subprocesses may be started after KeyboardInterrupt (or any other exception) is raised but before we get to the cancellation. When the race happens, the calling ninja may exit before Meson exits, causing some output (from clang-tidy/format and Meson's traceback) to be printed after returning to the shell prompt. But this is an improvement over potentially launching all the remaining tasks after having returned to the shell, which is what used to happen rather often. In practice, it appears that we cleanly exit with a pretty high probability unless CTRL-C is hit very early after starting (presumably before the thread pool has launched subprocesses on all its threads).
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-03-21Fix run_tool() when git is not installedAlyssa Ross
Previously, it would raise an exception.
2022-08-26Fix purely white space issues reported by flake8Alf Henrik Sauge
2022-03-29move a bunch of imports into TYPE_CHECKING blocksEli Schwartz
These are only used for type checking, so don't bother importing them at runtime. Generally add future annotations at the same time, to make sure that existing uses of these imports don't need to be quoted.
2021-11-14Share common code between clang tidy and formatXavier Claessens