Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1957968pxj; Sun, 9 May 2021 10:10:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLl5NJlGBzP7EzBU/g6rj5lcqNaTpE7PT9eH6m3jZveUhjlPcs+VAHcGkHgs889LBC0/iM X-Received: by 2002:a05:6638:10e4:: with SMTP id g4mr10866539jae.90.1620580217910; Sun, 09 May 2021 10:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620580217; cv=none; d=google.com; s=arc-20160816; b=wUeS/HM7ELqyQA4xUg5MIDDj0kn5FSoRpPJJgrczQIpwUmEW8u2FKKHQLrDO5YtR0I d+i97jSN16ctxTG63U7NeqYljjKxX2gKJ77f7/YQd0x/dcNRYNS11zXMZaoIyqNd5a2M 0PFLCzyCJMGJ3PHnbctvsDugGzPzYb7AwgAwMlhCvTf01BkuekZJIeqPg5k+SDSGfLgZ NbdC4ApNp6rs/8VHKNzQTm4ndQv8bYhjKy5OsygQOC2lmnoWUUyb8AJPtcG8Y9y1tbJr KMp4b3SDFX4bXzqJiBvcz0E3fdjXHIKy+NZkhbOCAgwum5Z889x8zeG296bL5i+Tgne/ aDCQ== 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:to:from:subject:message-id; bh=r7rAI8thx3cPRHyrMItq71zWQMLiOBAbDOn5f80u4K4=; b=L3l6OA4j/h1Qz2ftKg0qqCmez7gayrCIbukZWVEkGeqLDtHdVAfD82wWKJSHlI9UbB EFZ0UEvO8Vlhna9SuWUOJQcFkowLE0d6Df9eW7NVMEDJehZsSj3OezbolX27+21BsbYa Cch0mRCrBxKArE5rDNOIsfX/0QKoq1o7mSVg54GgD1/jZvgNyEe5RFBtkaQEUlF42+SC 8qzelhZnnM3Mt3ruUA+8tI93r5yQJcLzZ+7ZoFD3cZBVshpQ3eTwK5BuueyOwxCupHKi FdGTvFz3b/gFHeI0K1utVDSC90bkAxz+7NIW4t8+C74SUfbTdp1gPH/t1YT2n4s/GLyv K7dQ== 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 d2si13200891ilf.115.2021.05.09.10.10.02; Sun, 09 May 2021 10:10:17 -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 S229941AbhEIRDp (ORCPT + 99 others); Sun, 9 May 2021 13:03:45 -0400 Received: from smtprelay0215.hostedemail.com ([216.40.44.215]:58428 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229924AbhEIRDo (ORCPT ); Sun, 9 May 2021 13:03:44 -0400 Received: from omf02.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id A6CB718029D82; Sun, 9 May 2021 17:02:40 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA id 1BC3E1D42F4; Sun, 9 May 2021 17:02:40 +0000 (UTC) Message-ID: <6be9a194814f8fd113f4967d80c19f861b908356.camel@perches.com> Subject: Re: Codespell dictionary path is no longer absolute From: Joe Perches To: Dwaipayan Ray , linux-kernel Date: Sun, 09 May 2021 10:02:38 -0700 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 1BC3E1D42F4 X-Spam-Status: No, score=-2.84 X-Stat-Signature: g98wcsokpwo5qzyjqnn1ybyz9zxfekb1 X-Rspamd-Server: rspamout01 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX19+Tw4/r2/KfN9DDHloOYVYMG0z5wRA5Qo= X-HE-Tag: 1620579759-821716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2021-05-09 at 21:12 +0530, Dwaipayan Ray wrote: > A year ago, the codespell dictionary was moved from > /usr/share/codespell/dictionary.txt to data/dictionary.txt under > the codespell_lib installation directory. > > checkpatch.pl still has the default codespell path as > /usr/share/codespell/dictionary.txt. > Any new installations will now also need to specify --codespellfile > option along with --codespell. > > Can auto detection of the dictionary path be enabled with something > like this? [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -889,6 +889,9 @@ if (open(my $spelling, '<', $spelling_file)) { > } > > if ($codespell) { > + if (! -e "$codespellfile" && which("python") ne "") { > + $codespellfile = `python -c "import os.path as op; import code > spell_lib; print(op.join(op.dirname(codespell_lib.__file__), 'data', 'dictiona > ry.txt'), end='')"`; > + } Maybe, but it doesn't work with python2 And it's likely better to do as few things in python as possible so maybe ditch the op.join and use perl instead if (! -e "$codespellfile" && which("python") ne "" && `python -c "import sys; print(sys.version_info.major)"` >= "3") { $codespellfile = dirname(`python -c "import codespell_lib; print(codespell_lib.__file__);"`) . "/data/dictionary.txt"; }