Received: by 2002:a05:6520:1682:b0:147:d1a0:b502 with SMTP id ck2csp5609355lkb; Mon, 11 Oct 2021 09:54:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTemjciGl+vPcdo4n+ivMzB/6fUQQhks1NzT1HhY8cOZ6y0UuvbzbFrCohf804NUa5fE4K X-Received: by 2002:a17:906:4f19:: with SMTP id t25mr27370640eju.176.1633971246793; Mon, 11 Oct 2021 09:54:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633971246; cv=none; d=google.com; s=arc-20160816; b=dEdluSOg8u3N1TORJyzGrbM0n4D/GIxolVDxLIKxmVIRjzHvBUfCtTkMkSa7RlHbsP 47y+9eWB4oLDczSLYKY8oQkAW9Lg5ETm0w7achliZdZvFOO9xH75HAkYdESwixWktKhh iBS3zjE9mvPH807SX/e+66eEAoVE6VHGxF+9L7E76ns+uOFuOi/NIV/XsuHe5+ddzvXt y7QYsFmCQ0OE7ckQB8DWnG+bFxwj5mwFQeG+XZ9aH2WmPFJTmDqFAF5cVOAboMlOmi2/ fYMm11QSpJ8zP+YHoLIREjuX8MR0oJXNJSXYiZeXNZ0eexqiC/xnaqMGE3u4fxF/Hydo H3+g== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=Et/ZQ6IOfJaZKpPWaV5NsJY8a6E/I5M6SvYmrow2vBc=; b=zPEN2N0adCqmz3YX07n+tdxfsbRFl4AKDHpnp46SgSWxwHTSERcmfyhdZCiTsP9luv bAVg6L+ubeqgC45uzc2gMGxGIYZWkz2YeSMOE5FsmGSo2woohL8JZt5PDbhSiM8P/Ayj 0axIPi5CZIGtgOMmTjqDwML7a/gmWzEM1aHGXg9OlhySEnhN0MkgsSDuu1pCA2UapqGk 5m4eWRxK2t/VM5fm4kFUFsR8Sy5aNsgfNkWu9qaogNBP0pJk446FHAHKLxsZPOevnBe2 8NW3q7dXBIFfyGdDLdiEf17AxNchRVixkVPfx/78DAtughZkPYd2RyzYUz1z/C5/gJ4L K1OQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m4si12483720eda.546.2021.10.11.09.53.42; Mon, 11 Oct 2021 09:54:06 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232464AbhJKQw5 (ORCPT + 96 others); Mon, 11 Oct 2021 12:52:57 -0400 Received: from smtprelay0014.hostedemail.com ([216.40.44.14]:33112 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229816AbhJKQw4 (ORCPT ); Mon, 11 Oct 2021 12:52:56 -0400 Received: from omf15.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id D2905837F27E; Mon, 11 Oct 2021 16:50:55 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf15.hostedemail.com (Postfix) with ESMTPA id E2F04C4190; Mon, 11 Oct 2021 16:50:54 +0000 (UTC) Message-ID: <510f7db524904e2f87fe4d52018f712e2df3b7bc.camel@perches.com> Subject: Re: [PATCH v4] checkpatch: get default codespell dictionary path from package location From: Joe Perches To: Peter Ujfalusi , apw@canonical.com Cc: dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com, linux-kernel@vger.kernel.org Date: Mon, 11 Oct 2021 09:50:53 -0700 In-Reply-To: <20211011114952.26145-1-peter.ujfalusi@linux.intel.com> References: <20211011114952.26145-1-peter.ujfalusi@linux.intel.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.0-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.60 X-Stat-Signature: e3tytwfqwwysn614wks7ats48jkykjwx X-Rspamd-Server: rspamout03 X-Rspamd-Queue-Id: E2F04C4190 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+C7O3lW9EYEK/nsrd4geLk3eFCycocMFc= X-HE-Tag: 1633971054-828315 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-10-11 at 14:49 +0300, 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 [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > + # Try to find the codespell install location to use it as default path > + if (($codespell || $help) && 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); > + } This is really hard to read. Can this be written something like my $python_codespell_dict = << "EOF" import os.path as op import codespell_lib codespell_dir = op.dirname(codespell_lib.__file__) codespell_file = op.join(codespell_dir, 'data', 'dictionary.txt') print(codespell_file) EOF ; my $codespell_dict = `python3 -c "$python_codespell_dict" 2> /dev/null`;