Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1198132pxb; Mon, 11 Oct 2021 00:04:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8pdg0Z0XEMaHIxNfwaIiffkIpAUxa/xauDMF/0Md3nw9R6bIjVcscv1wxFG3dskptzSHX X-Received: by 2002:a05:6402:2789:: with SMTP id b9mr30747673ede.142.1633935860525; Mon, 11 Oct 2021 00:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633935860; cv=none; d=google.com; s=arc-20160816; b=TMY+1CCar2dDPPqwHKV1UBp7o1USXCEy4s+zsc5BLoCsMLTuSvf5jVwY7axl9bS19I p2BVlyU7vbTn9h9JXLC1+6SCmk2cVywhUgijr07V/Jh4HKhgP8akXzXh9of5gCSoY3pB CH3xxMjyWkoZhnqCWessX3NOFNtZOLctWa6Wi9PZ/PoYZ6gy5FXj12EJG3qUjwWB6xYr JxnZn21/CaNjm0PT94LDszaVx6jJyRQ5GluIL54uLNCffdQYSt+ZGB+JXPw5E6EfVPg4 vui3PFHfYfK5qndgxzFFsp8c8SYratTQwEyo8xALeDz1XwCaZUkxOwfGxtd3OQUws1sK loeg== 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; bh=vUh29RhLalHuaRoKJnRYvcGLj0VdxNHw0woa+vWpIz0=; b=WPcVdg5Fb7IYaobru3eKolPp3BUNqF5yhr03SD0kmYx6UhzBYSKVHHyP8ZGTTo5xtt OZnbr7o3heNdts8pJBPox2TGpJJNAARa1SHgLWjekqjFCgRGPkb3j1r7HBVoe5ftVwi5 No5zyFuLa3augTq3OJSvkBlmCYkG9nYZQsI8bikgAbn+dOijYr/jMmIsMJiDirlBkKxL lfEBeM96pZ8cLM+i6DVkgJZJbxy/kbyw/2eMRbyR9Dwcao12Yub4VuzJnfMiTDj+rrQo ix97BtTMDR53Bjaj7BrtmfvadkhPjToO5+cuJ1Avt5VssqCjV0+KjHyO5xpFkvjF9rCP BvyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lj16si6765222ejb.334.2021.10.11.00.03.56; Mon, 11 Oct 2021 00:04:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234107AbhJKGUb (ORCPT + 99 others); Mon, 11 Oct 2021 02:20:31 -0400 Received: from mga02.intel.com ([134.134.136.20]:9039 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233874AbhJKGUa (ORCPT ); Mon, 11 Oct 2021 02:20:30 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10133"; a="213952386" X-IronPort-AV: E=Sophos;i="5.85,363,1624345200"; d="scan'208";a="213952386" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2021 23:18:31 -0700 X-IronPort-AV: E=Sophos;i="5.85,363,1624345200"; d="scan'208";a="490337863" Received: from acleivam-mobl1.amr.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.249.40.144]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2021 23:18:29 -0700 From: Peter Ujfalusi To: apw@canonical.com, joe@perches.com Cc: dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, peter.ujfalusi@linux.intel.com, linux-kernel@vger.kernel.org Subject: [PATCH] checkpatch: get default codespell dictionary path from package location Date: Mon, 11 Oct 2021 09:18:39 +0300 Message-Id: <20211011061839.4199-1-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The standard location of dictionary.txt is under codespell's package, on my machine atm (codespell 2.1, Artix Linux): /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary.txt Since we enable the codespell by default for SOF I have constant: No codespell typos will be found - \ file '/usr/share/codespell/dictionary.txt': No such file or directory The patch proposes to try to fix up the path following the recommendation found here: https://github.com/codespell-project/codespell/issues/1540 Signed-off-by: Peter Ujfalusi --- scripts/checkpatch.pl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c27d2312cfc3..e8e416056066 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -73,6 +73,12 @@ my $git_command ='export LANGUAGE=en_US.UTF-8; git'; my $tabsize = 8; my ${CONFIG_} = "CONFIG_"; +# Override the codespellfile location based on codespell install location +if (which("codespell") ne "" && which("python") ne "") { + my $codespell_dict = `python -c "import os.path as op; import codespell_lib; print(op.join(op.dirname(codespell_lib.__file__), 'data', 'dictionary.txt'), end='')" 2> /dev/null`; + $codespellfile = $codespell_dict if (-e $codespell_dict) +} + sub help { my ($exitcode) = @_; @@ -130,7 +136,7 @@ Options: --ignore-perl-version override checking of perl version. expect runtime errors. --codespell Use the codespell dictionary for spelling/typos - (default:/usr/share/codespell/dictionary.txt) + (default:$codespellfile) --codespellfile Use this codespell dictionary --typedefsfile Read additional types from this file --color[=WHEN] Use colors 'always', 'never', or only when output -- 2.33.0