Skip to content

Commit 5c7548d

Browse files
asahilinaojeda
authored andcommitted
scripts: generate_rust_analyzer: Handle sub-modules with no Makefile
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 <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent c682e4c commit 5c7548d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scripts/generate_rust_analyzer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ def append_crate(display_name, root_module, deps, cfg=[], is_workspace_member=Tr
104104
name = path.name.replace(".rs", "")
105105

106106
# Skip those that are not crate roots.
107-
if f"{name}.o" not in open(path.parent / "Makefile").read():
107+
try:
108+
if f"{name}.o" not in open(path.parent / "Makefile").read():
109+
continue
110+
except FileNotFoundError:
108111
continue
109112

110113
logging.info("Adding %s", name)

0 commit comments

Comments
 (0)