Skip to content

Commit

Permalink
scripts: generate_rust_analyzer: Handle sub-modules with no Makefile
Browse files Browse the repository at this point in the history
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: #883
Signed-off-by: Asahi Lina <lina@asahilina.net>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
  • Loading branch information
asahilina authored and ojeda committed Apr 6, 2023
1 parent c682e4c commit 5c7548d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/generate_rust_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def append_crate(display_name, root_module, deps, cfg=[], is_workspace_member=Tr
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)
Expand Down

0 comments on commit 5c7548d

Please sign in to comment.