mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dwaipayan Ray <dwaipayanray1@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Codespell dictionary path is no longer absolute
Date: Sun, 09 May 2021 10:02:38 -0700	[thread overview]
Message-ID: <6be9a194814f8fd113f4967d80c19f861b908356.camel@perches.com> (raw)
In-Reply-To: <CABJPP5BExfW+xre-3E-9EysYMhLGRzNrkPbTW3qomOKqc31PSQ@mail.gmail.com>

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";
	}



      reply	other threads:[~2021-05-09 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-09 15:42 Dwaipayan Ray
2021-05-09 17:02 ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6be9a194814f8fd113f4967d80c19f861b908356.camel@perches.com \
    --to=joe@perches.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®