From patchwork Tue Mar 7 12:07:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Hindborg X-Patchwork-Id: 65418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2398343wrd; Tue, 7 Mar 2023 04:24:47 -0800 (PST) X-Google-Smtp-Source: AK7set9eEUJpJJZBxuQ9QRC0LABZraFIPGC10kJyEkEH1qmViI9l4Q16Jq0atFEiDl7s0Ce1kc/R X-Received: by 2002:a05:6a20:8f2a:b0:cc:50cd:e0bc with SMTP id b42-20020a056a208f2a00b000cc50cde0bcmr13222926pzk.10.1678191887333; Tue, 07 Mar 2023 04:24:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678191887; cv=none; d=google.com; s=arc-20160816; b=SAtyUey1bSXpUeWLCSZX0ZyQbLG6JkGUd+9vpKlWcnIj/w2RN23fB1xEmyQoOQgDZn +H0HnkBjAnMojXHBuDk4XbLzoLqTBbDNXCZaJuo6yhFn+w1CGnTtfOywwKPKb2mdQzbu JTCrCq6t0shQiE5ROy94LqTs0wTl8uAXRKDj05DPLBhRMCbpcVcx8lk98ZQf801YWl+Q S2+1aOxKUFK+sx+ctauzeEAzzWmG2yeMnaQdmwvKOedfm5ep+nuMVzvVX2SjigGVDB0n HzMJ1vIEWJSbqyHYaSW8Kfag22Iv+OQJvJfED3px+8X4knVqCg4eSm7tyKHN92W5JbE7 DQNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=N8+KuBNUOvMkQ5tG78D1gymPnKoB/geR+L27cmc6zCU=; b=oVFToT6hIVuGihg2X2bBBKssoA0lPP/4+QLs/aEJM0CiMmW8teNGFpWqfrf1Gbqvsi tEvFhyoSqjJZMDc3HNkZJhgsXuTh01eBFBUmD+RH1F59IzXW12yd8k4eEbBtvtxLS3aL kQhmpKDDr/4ltJvzn4xyL9gKslsXZKWTJkYPHWipkZkX0wwe7jVlbV4Mkj+Q4V2GrmMx xopaZXGzofDaOAulItlpulwd7P65EXicbf+iRVXAQ4CLb9+G81rEwCk1ZN0tYsTEmNXD yITPEGpNTSypu72+JTad1YfjSX+6QEsrTVOPW5gey2cotIa6foDP6x3D5CRi8249IrGo 0Liw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@metaspace-dk.20210112.gappssmtp.com header.s=20210112 header.b=JZiHCHIF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a630011000000b004fc274006d9si12046640pga.368.2023.03.07.04.24.34; Tue, 07 Mar 2023 04:24:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@metaspace-dk.20210112.gappssmtp.com header.s=20210112 header.b=JZiHCHIF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231293AbjCGMIH (ORCPT + 99 others); Tue, 7 Mar 2023 07:08:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbjCGMIF (ORCPT ); Tue, 7 Mar 2023 07:08:05 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A018B37F28 for ; Tue, 7 Mar 2023 04:08:03 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id az36so7611939wmb.1 for ; Tue, 07 Mar 2023 04:08:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metaspace-dk.20210112.gappssmtp.com; s=20210112; t=1678190882; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=N8+KuBNUOvMkQ5tG78D1gymPnKoB/geR+L27cmc6zCU=; b=JZiHCHIFrKxIz+YAYok47ojhjGpd5HwreP81Bh/lztS9vQDw3MXjwvGiui7nRTyoaQ PRCXJJ2z/aVQNYI+CoywYgwTyaUqJY1EX433/qaD0v6YMv0OzGDgneR3iiLpl3zWZltx S5EWYYG6935vjVpUmlqFRQwVVtx3wvWt+dXqrm50NxWKMSp5GKqKQtwjDA2Sbuc2aqyZ AO7mUNqW3+gBhC1eNajMLFKpMMW+TN1wNX9uruW+dxJrI+sTQ41XnkCgmmaDtxINXnE/ 4SWn6tOI3YOiJb8NRC3tKMAMgJH6khkfYce0wUmpT9PF0zqjG6DW9fzEJKwSSnQRN2XU bI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678190882; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=N8+KuBNUOvMkQ5tG78D1gymPnKoB/geR+L27cmc6zCU=; b=vuNgYmUmwG7udQ/YI2Unrd+aNhHjx4s+XFMX1v+Aaz9QaJnYFzbywiCGxznGZ/Rtzp hAZ9IAfNUvLlCYrcx+uKApUBBzqhHkayz/9jOqTJAt6h2t1iZSVWPgJgf37rRWwmAylj PJAbSEnVXPBDJsa+7CfSv8kTepv8EWOEQv6a0CH/Pf2PGmrVr0tfHtLJAHmG5tBf3nw8 qEqeO5Gni4ZSbiU6pXLGFzGDgSx2ZTucRfCEByRr8hjNDUilOq8sSJTcH3cdnhVZVKP8 eCmk0+KLfIQz5u8rbTTzi5WzNrz7YzKVEj86azNUziqhEcZfHKtr4Rb5IsEH88FD43Dr ybig== X-Gm-Message-State: AO0yUKUSYFHPok4w1iB4wlwHgX2tuFAbNxjuiRoIcnYAVWxhMIJ0rYeY HX1geY+lw+clAW/1fOgE0fwmMg== X-Received: by 2002:a05:600c:4688:b0:3eb:42fc:fb30 with SMTP id p8-20020a05600c468800b003eb42fcfb30mr12992036wmo.32.1678190882157; Tue, 07 Mar 2023 04:08:02 -0800 (PST) Received: from localhost ([147.161.155.97]) by smtp.gmail.com with ESMTPSA id v38-20020a05600c4da600b003eb68bb61c8sm12351014wmp.3.2023.03.07.04.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 04:08:01 -0800 (PST) From: Andreas Hindborg To: rust-for-linux@vger.kernel.org Cc: Andreas Hindborg , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] scripts: rust-analyzer: Skip crate module directories Date: Tue, 7 Mar 2023 13:07:36 +0100 Message-Id: <20230307120736.75492-1-nmi@metaspace.dk> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759711736339314764?= X-GMAIL-MSGID: =?utf-8?q?1759711736339314764?= 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 --- scripts/generate_rust_analyzer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) base-commit: 8c20eb7e6a27b2c493b0bbb435e75cae7135634f 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)