Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1198193pxb; Mon, 11 Oct 2021 00:04:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+o0gK6Gog5jFQzCorj6EvghzaZi0ZwbglBJb2AFngSB82fkwWS1Q2eVCb7JW06Dw19hjp X-Received: by 2002:a17:906:1815:: with SMTP id v21mr635007eje.218.1633935866716; Mon, 11 Oct 2021 00:04:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633935866; cv=none; d=google.com; s=arc-20160816; b=uTGSP3Hb6Qt32YeMjtyGtkN1rgorMsxlAsCxenO7hHhgr/Yz4Qzhxed9iq8stAKlrM shtA1WvsgHLyHEDfkhxF0Zz8NBzGhu/EGgHYfnf1CE4SicGqfkLrSOtCunZ1ceDGbfTV xa9eta/NYZWqDIn+uO0UBx97xjn5WwaC0DUElNMeBZ+q9oQc39FdKJyTXNri1E79kZQ4 PprqoZ46s834n2UW3gZXwwLQU/omMsOWp70b1Ck9MCHdNDPRa6XBY7sKaMQDZ1Df/6mX czKsCke5tQgFcAZN/cj89QTHHxfD/Vmg/ovX5mJ7AwEWv/eX2Fz0PwiFh+X93J7R5VnA CjgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=a2NqEw12LQno5vWlGYoEprIJroqq47Y6sTRIz67JrPE=; b=R+ZPQxj+oi3lt10YQtaXvagxM13Y7k0uqavSm+92z7MN/z745eTCzVxvI5cgWHjnjh +gcMh0Miiay4B4j1az65kzc2EhiYEW2Vjz22+WTX0ogDcShqokcD3kilmCeefwtWaRLk a75EFrgiskPUp+/hk5S/HSDv+A8ILOUftieR1YEzuylQCDRqtn8KzH+fBxBzTlIWlkJR Hz1/C+3mmlm4M3GAqqqqDzWrCZLAN1LJVfJVnAJklZ6tRkJjxUt4LtzCK7wr4SBaBrki UJLX+LyyxnMyX1gMtlMDdMkiNGNxRmot74gWflocubJU6Z+RbqJRjM8Vy8fOjCvJwY8G iNow== 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 m26si10305951edb.316.2021.10.11.00.04.03; Mon, 11 Oct 2021 00:04:26 -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 S234123AbhJKGbU (ORCPT + 99 others); Mon, 11 Oct 2021 02:31:20 -0400 Received: from mga18.intel.com ([134.134.136.126]:47880 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234080AbhJKGbR (ORCPT ); Mon, 11 Oct 2021 02:31:17 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10133"; a="213753493" X-IronPort-AV: E=Sophos;i="5.85,364,1624345200"; d="scan'208";a="213753493" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2021 23:29:12 -0700 X-IronPort-AV: E=Sophos;i="5.85,364,1624345200"; d="scan'208";a="490343504" Received: from acleivam-mobl1.amr.corp.intel.com (HELO [10.249.40.144]) ([10.249.40.144]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2021 23:29:10 -0700 Message-ID: <8f0c41be-fffc-0f02-ab91-450dc198e860@linux.intel.com> Date: Mon, 11 Oct 2021 09:29:21 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH] checkpatch: get default codespell dictionary path from package location Content-Language: en-US To: apw@canonical.com, joe@perches.com Cc: dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, linux-kernel@vger.kernel.org References: <20211011061839.4199-1-peter.ujfalusi@linux.intel.com> From: =?UTF-8?Q?P=c3=a9ter_Ujfalusi?= In-Reply-To: <20211011061839.4199-1-peter.ujfalusi@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/10/2021 09:18, Peter Ujfalusi wrote: > 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) I have missed ';' at the end of the line (the checkpatch.pl worked as expected, that's why I have not noticed it) sending v2 right away, sorry. > +} > + > 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 > -- Péter