* Codespell dictionary path is no longer absolute
@ 2021-05-09 15:42 Dwaipayan Ray
2021-05-09 17:02 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Dwaipayan Ray @ 2021-05-09 15:42 UTC (permalink / raw)
To: Joe Perches, linux-kernel
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
index 23697a6b1eaa..28ca5cfff2d5 100755
--- 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='')"`;
+ }
if (open(my $spelling, '<', $codespellfile)) {
while (<$spelling>) {
my $line = $_;
-----
Thanks,
Dwaipayan.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: Codespell dictionary path is no longer absolute
2021-05-09 15:42 Codespell dictionary path is no longer absolute Dwaipayan Ray
@ 2021-05-09 17:02 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2021-05-09 17:02 UTC (permalink / raw)
To: Dwaipayan Ray, linux-kernel
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";
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-09 17:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-09 15:42 Codespell dictionary path is no longer absolute Dwaipayan Ray
2021-05-09 17:02 ` Joe Perches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.