Received: by 10.223.176.5 with SMTP id f5csp647527wra; Tue, 6 Feb 2018 05:12:02 -0800 (PST) X-Google-Smtp-Source: AH8x227/GcaaLOxNfNwcU7u0GQPcH06zM3y915KXlJnoWXjYXbsHDopV9e/Xzyxpy82hIqS6MJMs X-Received: by 2002:a17:902:bf01:: with SMTP id bi1-v6mr2359869plb.254.1517922722177; Tue, 06 Feb 2018 05:12:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517922722; cv=none; d=google.com; s=arc-20160816; b=knYaw7X6Q+15OP0JFDQqWs2KY/1c/IsIGa9pN7u9581ZNX/pvlQ/WF5ULyHC8dGypB DG27aBDmEImAr4R0GfTAOnH5ZFA2bUM0oMbs8KwRCmR8lgaGm/CkG1t5ETwG7hxGcVG2 CSwZHRC/J1/3anu/9gIFzyrX8LfTVVhXAqzQ79PmapjWVUjQwjjNv0vcCpuBqAIRGZrn vXohUAx06migAHn8TqIJshEVN65BwwarEFJPiy38LCcLrXivfZJS5wjpKnfqmVQOfnHV 0InpST/IwKw3Tt5ptAuYR2x5M7UAobr7j8Rb874uzNnfg9kvHs5z8ITAT4J75UvX3lfj EpBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=6AF0HxZ/64W2Ln1bxuH3MMpYfs8NjtMfN5LppdUpw+8=; b=FbtNA9oeJ3wI0ytjhH8/dWWogwxUUmFRQke9MlOadG48Ob8nlz+kOUSv+FZR1OrB/L Td17tf5avQOoSY/Q0LGJ8UB2ZynKSB+fNVEWrWYJH1tSoS7m65GrTuuWXCDw85UrIgce 1nT6pnmdAA668LaV5RkOHX3JVDV9XBQUhzPLhElfXiVku/brMuw6SNXaCGIcj/J88G3P 3ItqlizFU3T5FUhHVMuRPReNuu5gqP4NZsABK7TFqPv/OVFqtXqgzDFC1ZhQUzlqG0By 3PWo2ks6g31NCgDMBfGzcT6XGyxLEbh2Mf4v7JDrfzoHSAnjHzZkEV2+gTB77/c2u+OR rSeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y27si900714pfi.382.2018.02.06.05.11.47; Tue, 06 Feb 2018 05:12:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbeBFNK0 (ORCPT + 99 others); Tue, 6 Feb 2018 08:10:26 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47182 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752791AbeBFNKT (ORCPT ); Tue, 6 Feb 2018 08:10:19 -0500 Received: from localhost (unknown [209.136.236.94]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6001E10F8; Tue, 6 Feb 2018 13:10:18 +0000 (UTC) Date: Tue, 6 Feb 2018 05:10:17 -0800 From: Greg Kroah-Hartman To: Masahiro Yamada Cc: Linux Kbuild mailing list , Andrew Morton , Nicolas Pitre , "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Michal Marek , Linus Torvalds , Tony Luck , linux-ia64@vger.kernel.org, Linux Kernel Mailing List , Fenghua Yu Subject: Re: [PATCH 06/14] kbuild: define PYTHON2 and PYTHON3 variables instead of PYTHON Message-ID: <20180206131017.GF31804@kroah.com> References: <1517877294-4826-1-git-send-email-yamada.masahiro@socionext.com> <1517877294-4826-7-git-send-email-yamada.masahiro@socionext.com> <20180206093450.GB31558@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 06, 2018 at 07:44:22PM +0900, Masahiro Yamada wrote: > 2018-02-06 18:34 GMT+09:00 Greg Kroah-Hartman : > > 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 > >> --- > >> > >> 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