Received: by 10.223.176.5 with SMTP id f5csp506796wra; Tue, 6 Feb 2018 02:46:11 -0800 (PST) X-Google-Smtp-Source: AH8x225AerK5rRfBGtzXBweIeRi+zNAOzdtXjj91C1GYimx4l8s6bsuM/TnZlUcUno7aoEryUpCb X-Received: by 2002:a17:902:bd84:: with SMTP id q4-v6mr1978891pls.247.1517913971096; Tue, 06 Feb 2018 02:46:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517913971; cv=none; d=google.com; s=arc-20160816; b=qGG/VmYFsAd0FuSLpxvKbnEC7bNVTypN9gB1ZeD62ODqhGbXDNAMRckW3ml4/r7HVI 5GOTZ8UmYtxlmdRWgED/5JrTY52OebNeNsor4rSmS9XL4aJQNsTI4Si03OwufeH0ISIc 35rztwuPo2yopik9j6lwW8rzt4/Pa70A6hRKEDDmDVRxzfKu1ykw0oRkXtTvagb3Mku9 diLlOeLQ7L6Ie22GOVoI7Q2jDZQS8ei/xPUY8h9iWeOII6fa305xNE4zFS46nX+OTbr3 W7kZ9hb7Y5LYeeBRoEiCQe8RtcrMxYaaXKlHHHRP3xwVjF61pJ2HMKWkt5KM2LQ4bKEa O7cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=Aoa7rZ8c8jqUw6pte6o6fZBNoH1rOkKhc4D/QCln3tk=; b=CgvvMiLbcIYecGfnjFzLIA8aiLR9UwyVk1IIk5VJmBf2IoreUu1X4OJOj/PY7b6Bh3 /4VL4VO2nhEa+R8Uitb2ZhKh+JO5DKo/mFZGymJLvyGHGPd3bsxad3r0J3vBsxxJaiue RyGcRAiQQOdz4QPqAbLeZLfmWlvjGHdAMNOARzLbT0h+pSAxzujSIaYcZxaa6IE3wxrg aoYNoR620CnAwb2dXKUdk7WUNBT/21lTNelG4dqRta0Eto2WR86E/I/8FqHyI1aoSivy th6AmRJ/pXAcevTxEoUFLUS0/q4CoQUoLvecpPbIqPWeK8ATvm5jDLALy6gc2uZ+4POb GHTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=IPeLzkum; 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 j19-v6si8233163pll.799.2018.02.06.02.45.56; Tue, 06 Feb 2018 02:46:11 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=IPeLzkum; 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 S1752737AbeBFKp2 (ORCPT + 99 others); Tue, 6 Feb 2018 05:45:28 -0500 Received: from conssluserg-01.nifty.com ([210.131.2.80]:39188 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752246AbeBFKpW (ORCPT ); Tue, 6 Feb 2018 05:45:22 -0500 X-Greylist: delayed 36436 seconds by postgrey-1.27 at vger.kernel.org; Tue, 06 Feb 2018 05:45:21 EST Received: from mail-vk0-f45.google.com (mail-vk0-f45.google.com [209.85.213.45]) (authenticated) by conssluserg-01.nifty.com with ESMTP id w16Aj3Wi007821; Tue, 6 Feb 2018 19:45:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com w16Aj3Wi007821 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517913904; bh=Aoa7rZ8c8jqUw6pte6o6fZBNoH1rOkKhc4D/QCln3tk=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=IPeLzkum2u0EQopNjAe89M7cv6R2r4Pfu0dt8I2EGAte8bUtMFKC15cGpCNtD7fHc pyErys9fNt6O4WcjNo2T5xy/kylpb2qw74p7C+q1ZPXFuaSzzV7NBup6JbkRVFNsJ2 vukog8d/PiI86bSbgRPEFm7nGPTNddU7/3ajOPqMqGPRVQBeTTFZFDJHXyywOm9sRd NHuQweiIprkvbNN3M17ddz9CDdWl1DjF6SCJvv7zmnUrY1zgif2kgJY6+25jLyDGFz IGD1aJZlbV1Op+XCkZ0+Zg04NIh/iKsU0q/+KfcfpmNJDI/sy24qw5Xmr09bxmTrjA oYJHCpmb7O28g== X-Nifty-SrcIP: [209.85.213.45] Received: by mail-vk0-f45.google.com with SMTP id m197so818756vka.3; Tue, 06 Feb 2018 02:45:04 -0800 (PST) X-Gm-Message-State: APf1xPD5Y7fq5uCLvmyUiojOv2aC67qz8tfyu/zae9+FIxHRTfGCNkBq I0x2J+fpIRdNWwcjapvovQ/MWxIUObHhBsltpLs= X-Received: by 10.31.85.193 with SMTP id j184mr1745777vkb.152.1517913903128; Tue, 06 Feb 2018 02:45:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.83.212 with HTTP; Tue, 6 Feb 2018 02:44:22 -0800 (PST) In-Reply-To: <20180206093450.GB31558@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> From: Masahiro Yamada Date: Tue, 6 Feb 2018 19:44:22 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 06/14] kbuild: define PYTHON2 and PYTHON3 variables instead of PYTHON To: Greg Kroah-Hartman 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) 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)) -- Best Regards Masahiro Yamada