Skip to contentSkip to conversation

checkpatch: explicitly require python3 for codespell

PATCH In review Alexander Lobakin 1 participant 2 messages Dec 7, 2021 – Jan 3, 2022 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: explicitly require python3 for codespell

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.

---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +2 -2
index 1784921c645d..6943f1e507f1 100755
@@ -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);
 	}
 }
Signature · 1 line
2.33.1
#1 lore raw

From: Alexander Lobakin <[email protected]>
Date: Tue, 7 Dec 2021 22:13:16 +0100

Quoted 10 lines

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.

---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Ping?

Quoted 25 lines
scripts/checkpatch.pl +2 -2
index 1784921c645d..6943f1e507f1 100755
@@ -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);
 	}
 }
Signature · 1 line
2.33.1

Al