[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230307120736.75492-1-nmi@metaspace.dk>
Date: Tue, 7 Mar 2023 13:07:36 +0100
From: Andreas Hindborg <nmi@...aspace.dk>
To: rust-for-linux@...r.kernel.org
Cc: Andreas Hindborg <a.hindborg@...sung.com>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] scripts: rust-analyzer: Skip crate module directories
When generating rust-analyzer configuration, skip module directories. This fixes
an issue that occur if we have
- drivers/block/driver.rs
- drivers/block/driver_mod/mod.rs
If `driver_mod` is a module of the crate `driver`, the directory `driver_mod`
may not contain `Makefile`, and `generate_rust_analyzer.py` will fail.
Signed-off-by: Andreas Hindborg <a.hindborg@...sung.com>
---
scripts/generate_rust_analyzer.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
index ecc7ea9a4dcf..e8c643fb2488 100755
--- a/scripts/generate_rust_analyzer.py
+++ b/scripts/generate_rust_analyzer.py
@@ -104,7 +104,7 @@ 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():
+ if not (path.parent / "Makefile").is_file() or f"{name}.o" not in open(path.parent / "Makefile").read():
continue
logging.info("Adding %s", name)
base-commit: 8c20eb7e6a27b2c493b0bbb435e75cae7135634f
--
2.39.2
Powered by blists - more mailing lists