linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Andy Whitcroft <apw@canonical.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Bert Vermeulen <bert@biot.com>
Subject: Re: [PATCH] checkpatch: scripts/spdxcheck.py now requires python3
Date: Wed, 05 May 2021 14:54:59 -0700	[thread overview]
Message-ID: <388ba4aa3ebbae03776aae3c70303077c19e1274.camel@perches.com> (raw)
In-Reply-To: <20210505211720.447111-1-linux@roeck-us.net>

On Wed, 2021-05-05 at 14:17 -0700, Guenter Roeck wrote:
> Since commit d0259c42abff ("spdxcheck.py: Use Python 3"), spdxcheck.py
> explicitly expects to run as python3 script. If "python" still points to
> python v2.7 and the script is executed with "python scripts/spdxcheck.py",
> the following error may be seen even if git-python is installed for
> python3.
> 
> Traceback (most recent call last):
>   File "scripts/spdxcheck.py", line 10, in <module>
>     import git
> ImportError: No module named git
> 
> To fix the problem, check for the existence of python3, check if
> the script is executable and not just for its existence, and execute
> it directly.
> 
> Cc: Bert Vermeulen <bert@biot.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Seems sensible, thanks.

> ---
>  scripts/checkpatch.pl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index ccb412a74725..8a1b782dd7e7 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1084,10 +1084,10 @@ sub is_maintained_obsolete {
>  sub is_SPDX_License_valid {
>  	my ($license) = @_;
>  
> 
> -	return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py") || !(-e "$gitroot"));
> +	return 1 if (!$tree || which("python3") eq "" || !(-x "$root/scripts/spdxcheck.py") || !(-e "$gitroot"));
>  
> 
>  	my $root_path = abs_path($root);
> -	my $status = `cd "$root_path"; echo "$license" | python scripts/spdxcheck.py -`;
> +	my $status = `cd "$root_path"; echo "$license" | scripts/spdxcheck.py -`;
>  	return 0 if ($status ne "");
>  	return 1;
>  }



      reply	other threads:[~2021-05-05 21:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 21:17 [PATCH] checkpatch: scripts/spdxcheck.py now requires python3 Guenter Roeck
2021-05-05 21:54 ` 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=388ba4aa3ebbae03776aae3c70303077c19e1274.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=bert@biot.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lukas.bulwahn@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).