mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] checkpatch: explicitly require python3 for codespell
@ 2021-12-07 21:13 Alexander Lobakin
  2022-01-03 14:22 ` Alexander Lobakin
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Lobakin @ 2021-12-07 21:13 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: Alexander Lobakin, Dwaipayan Ray, Lukas Bulwahn, linux-kernel

Fix a bug where checkpatch couldn't automatically find
dictionary.txt.
"Unversioned" `which python` might be not present in a system
with Python 3 and codespell installed and working. SPDX check
already refers to `which python3`, do the same for codespell.

Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1784921c645d..6943f1e507f1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -334,7 +334,7 @@ if ($user_codespellfile) {
 } elsif (!(-f $codespellfile)) {
 	# If /usr/share/codespell/dictionary.txt is not present, try to find it
 	# under codespell's install directory: <codespell_root>/data/dictionary.txt
-	if (($codespell || $help) && which("codespell") ne "" && which("python") ne "") {
+	if (($codespell || $help) && which("codespell") ne "" && which("python3") ne "") {
 		my $python_codespell_dict = << "EOF";
 
 import os.path as op
@@ -344,7 +344,7 @@ codespell_file = op.join(codespell_dir, 'data', 'dictionary.txt')
 print(codespell_file, end='')
 EOF
 
-		my $codespell_dict = `python -c "$python_codespell_dict" 2> /dev/null`;
+		my $codespell_dict = `python3 -c "$python_codespell_dict" 2> /dev/null`;
 		$codespellfile = $codespell_dict if (-f $codespell_dict);
 	}
 }
-- 
2.33.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] checkpatch: explicitly require python3 for codespell
  2021-12-07 21:13 [PATCH] checkpatch: explicitly require python3 for codespell Alexander Lobakin
@ 2022-01-03 14:22 ` Alexander Lobakin
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Lobakin @ 2022-01-03 14:22 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches
  Cc: Alexander Lobakin, Andrew Morton, Arnd Bergmann, Dwaipayan Ray,
	Lukas Bulwahn, linux-kernel

From: Alexander Lobakin <alexandr.lobakin@intel.com>
Date: Tue,  7 Dec 2021 22:13:16 +0100

> Fix a bug where checkpatch couldn't automatically find
> dictionary.txt.
> "Unversioned" `which python` might be not present in a system
> with Python 3 and codespell installed and working. SPDX check
> already refers to `which python3`, do the same for codespell.
> 
> Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
> ---
>  scripts/checkpatch.pl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Ping?

> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 1784921c645d..6943f1e507f1 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -334,7 +334,7 @@ if ($user_codespellfile) {
>  } elsif (!(-f $codespellfile)) {
>  	# If /usr/share/codespell/dictionary.txt is not present, try to find it
>  	# under codespell's install directory: <codespell_root>/data/dictionary.txt
> -	if (($codespell || $help) && which("codespell") ne "" && which("python") ne "") {
> +	if (($codespell || $help) && which("codespell") ne "" && which("python3") ne "") {
>  		my $python_codespell_dict = << "EOF";
>  
>  import os.path as op
> @@ -344,7 +344,7 @@ codespell_file = op.join(codespell_dir, 'data', 'dictionary.txt')
>  print(codespell_file, end='')
>  EOF
>  
> -		my $codespell_dict = `python -c "$python_codespell_dict" 2> /dev/null`;
> +		my $codespell_dict = `python3 -c "$python_codespell_dict" 2> /dev/null`;
>  		$codespellfile = $codespell_dict if (-f $codespell_dict);
>  	}
>  }
> -- 
> 2.33.1

Al

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-03 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 21:13 [PATCH] checkpatch: explicitly require python3 for codespell Alexander Lobakin
2022-01-03 14:22 ` Alexander Lobakin

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®