diff options
| author | Asahi Lina <lina@asahilina.net> | 2023-04-07 00:25:22 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-28 21:58:57 +0100 |
| commit | d266fc89bc9a152cfa8a256ba8b5d916e559721c (patch) | |
| tree | 84f8db7df70ef7637ac452a07d5bc54781759cfb /scripts/generate_rust_analyzer.py | |
| parent | 99ddc1491b758d0b8cd28322d6cfd07bab509fb0 (diff) | |
| download | linux-d266fc89bc9a152cfa8a256ba8b5d916e559721c.tar.gz linux-d266fc89bc9a152cfa8a256ba8b5d916e559721c.tar.bz2 linux-d266fc89bc9a152cfa8a256ba8b5d916e559721c.zip | |
scripts: generate_rust_analyzer: Handle sub-modules with no Makefile
[ Upstream commit 5c7548d5a25306dcdb97689479be81cacc8ce596 ]
More complex drivers might want to use modules to organize their Rust
code, but those module folders do not need a Makefile.
generate_rust_analyzer.py currently crashes on those. Fix it so that a
missing Makefile is silently ignored.
Link: https://github.com/Rust-for-Linux/linux/pull/883
Signed-off-by: Asahi Lina <lina@asahilina.net>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Stable-dep-of: 2e0f91aba507 ("scripts: generate_rust_analyzer: add missing macros deps")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
| -rwxr-xr-x | scripts/generate_rust_analyzer.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py index 75bb611bd751..ab6af280b9de 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -98,7 +98,10 @@ def generate_crates(srctree, objtree, sysroot_src): name = path.name.replace(".rs", "") # Skip those that are not crate roots. - if f"{name}.o" not in open(path.parent / "Makefile").read(): + try: + if f"{name}.o" not in open(path.parent / "Makefile").read(): + continue + except FileNotFoundError: continue logging.info("Adding %s", name) |
