public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	"Luis R . Rodriguez" <mcgrof@suse.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	Ulf Magnusson <ulfalizer@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Tony Luck <tony.luck@intel.com>,
	linux-ia64@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Fenghua Yu <fenghua.yu@intel.com>
Subject: Re: [PATCH 06/14] kbuild: define PYTHON2 and PYTHON3 variables instead of PYTHON
Date: Tue, 06 Feb 2018 13:10:17 +0000	[thread overview]
Message-ID: <20180206131017.GF31804@kroah.com> (raw)
In-Reply-To: <CAK7LNAS_29myncTw+6u7fH9BgjzZJfXSN1CJjOjK-qXjPRQ8hQ@mail.gmail.com>

On Tue, Feb 06, 2018 at 07:44:22PM +0900, Masahiro Yamada wrote:
> 2018-02-06 18:34 GMT+09:00 Greg Kroah-Hartman <gregkh@linuxfoundation.org>:
> > On Tue, Feb 06, 2018 at 09:34:46AM +0900, Masahiro Yamada wrote:
> >> The variable 'PYTHON' allows users to specify a proper executable
> >> name in case the default 'python' does not work.  However, this does
> >> not address the case where both Python 2 and Python 3 scripts are
> >> used in one system.
> >>
> >> PEP 394 (https://www.python.org/dev/peps/pep-0394/) provides a
> >> convention for Python scripts portability.  Here is a quotation:
> >>
> >>   In order to tolerate differences across platforms, all new code
> >>   that needs to invoke the Python interpreter should not specify
> >>   'python', but rather should specify either 'python2' or 'python3'.
> >>   This distinction should be made in shebangs, when invoking from a
> >>   shell script, when invoking via the system() call, or when invoking
> >>   in any other context.
> >>
> >> arch/ia64/scripts/unwcheck.py is apparently written in Python 2, so
> >> it should be invoked by 'python2'.
> >>
> >> It is legitimate to use 'python' for scripts compatible with both
> >> Python 2 and Python 3, but this is rare (at least I do not see the
> >> case in kernel tree).  You do not need to make efforts to write your
> >> scripts in that way.  Anyway, Python 2 will retire in 2020.
> >>
> >> This commit is needed for my new scripts written in Python 3.
> >>
> >> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> >> ---
> >>
> >>  Makefile           | 5 +++--
> >>  arch/ia64/Makefile | 2 +-
> >>  2 files changed, 4 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/Makefile b/Makefile
> >> index 11aff0f..c4e935c 100644
> >> --- a/Makefile
> >> +++ b/Makefile
> >> @@ -384,7 +384,8 @@ GENKSYMS  = scripts/genksyms/genksyms
> >>  INSTALLKERNEL  := installkernel
> >>  DEPMOD               = /sbin/depmod
> >>  PERL         = perl
> >> -PYTHON               = python
> >> +PYTHON2              = python2
> >> +PYTHON3              = python3
> >
> > Is this going to break any systems that were previous setting PYTHON?
> >
> > I like this change, and feel it is the correct thing to do, but having a
> > "fallback" might be needed here.
> >
> > Could you do what the perf makefile does and do something like:
> >         override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
> > or is it really not an issue as only ia64 seems to care about this?
> >
> 
> As far as I see, ia64 is the only instance that has used this ever.
> 
> (the perf Makefile defines PYTHON by itself, so should not be a problem.)
> 
> 
> If people expect the backward-compatibility for this, I can do like follows:
> 
> # backward compatibility for 'PYTHON'
> PYTHON2  := $(if $(PYTHON), $(PYTHON), python2)

That's true, and who knows if python3 is running on ia64 :)

> Another (unlikely) possible breakage is
> 'python2' may not be installed on users' system.
> 
> I believe this is rare, but if needed, I could do like follows
> at the cost of ugliness.
> 
> 
> PYTHON2 := $(if $(PYTHON), $(PYTHON), \
>         $(shell python2 --version 2>/dev/null && echo python2 || echo python))

Ick, I guess that might work.  Try getting your patch set into the 0-day
system to see how it handles things.  I know it builds for ia64.

But this is a real tiny question overall, and should not derail this
patchset at all :)

thanks,

greg k-h

  reply	other threads:[~2018-02-06 13:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06  0:34 [PATCH 00/14] Add Kconfig unit tests Masahiro Yamada
2018-02-06  0:34 ` [PATCH 06/14] kbuild: define PYTHON2 and PYTHON3 variables instead of PYTHON Masahiro Yamada
2018-02-06  9:34   ` Greg Kroah-Hartman
2018-02-06 10:44     ` Masahiro Yamada
2018-02-06 13:10       ` Greg Kroah-Hartman [this message]
2018-02-06 17:07         ` Luck, Tony
2018-02-06  9:38 ` [PATCH 00/14] Add Kconfig unit tests Greg Kroah-Hartman
2018-02-07 23:19   ` Ulf Magnusson
2018-02-18 19:38 ` Sam Ravnborg

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=20180206131017.GF31804@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=fenghua.yu@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@suse.com \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.pitre@linaro.org \
    --cc=rdunlap@infradead.org \
    --cc=sam@ravnborg.org \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    --cc=ulfalizer@gmail.com \
    --cc=yamada.masahiro@socionext.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