From patchwork Tue Mar 13 09:12:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 131420 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp485176ljb; Tue, 13 Mar 2018 02:16:53 -0700 (PDT) X-Google-Smtp-Source: AG47ELsAV/h6VnHN92Fr9/ChWK04rLkzA6E16AmFeLxKIfcy7crrMZuRIsUxJOFLM3LJ9iy3duA2 X-Received: by 2002:a17:902:8d87:: with SMTP id v7-v6mr11113290plo.146.1520932613565; Tue, 13 Mar 2018 02:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520932613; cv=none; d=google.com; s=arc-20160816; b=kgmb3a2PSHLhyktg47PWJIJsBY6ivFDlF6pywdXF+5k1JdncCWugI/HyGj691nU8Ty rDk01ueBMSJLWfrHkw2LcfEK8oOevL2MtYsmrRUtOfZlWFh+Zf+oqkpQyITOKYd0lGuY 9ZmWNXgpnAQyriheQqq1irShGI/iYfZFFzlKB9xNKJ0LrHBFo+ZmR6yGIezZytJbEB1H ZqFKSMvqs58HbJYvd767AgAkw24k68P5Ve+mC/6gvvaYh/vRVxcNSZTjXbpImIPzafvH hEHYPrP1l+1aa1yD5ZsYNQ3fG4+vl8rVX+EMOwCP94VgpFHUqaGzHtiFEGuWBcmO3/ja sFiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=uVZpVmz+OOBd3qoL/yP203TDWbvn86FxgDbftaI9fcI=; b=aJ8unljgx7kfeDuyG3ySo9/haHuDgj/DuiKh7xCfUMjCQA0l8JVcUuYEusLkWLJ7k6 uf/jXVZTwSvfgbncgGhppMH73me5IFTLBRv1I7OauxxWjYqixkBqM5cXGh2ywHZzGQxa xa+A8bFVbiFq0TS5QdB6G731HMnOJsdlOPTAlyvEKr847kGWTN89JSWF3DexHsuzRZer 6uSri+rVqduB8d6dwT/OGKNJPDRrbc7EyNXpnd7Ly5ZYIvUHv+eknbCMovUHtnLQpUwj rtsLXfm92gEauiz8SSjs/Z5Go95SQVwX4iwRcZEQWzHZEOeURR4vw1qhsk/LtYvY/+Gr v09Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=LPKBNofB; 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 z1si6209853pgv.563.2018.03.13.02.16.53; Tue, 13 Mar 2018 02:16:53 -0700 (PDT) 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=LPKBNofB; 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 S1752505AbeCMJOA (ORCPT + 28 others); Tue, 13 Mar 2018 05:14:00 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:41660 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752302AbeCMJN4 (ORCPT ); Tue, 13 Mar 2018 05:13:56 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w2D9CIo2016505; Tue, 13 Mar 2018 18:12:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w2D9CIo2016505 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1520932339; bh=uVZpVmz+OOBd3qoL/yP203TDWbvn86FxgDbftaI9fcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LPKBNofBJQeu+xBLEwC9nylNgJYL7mHTNuR5lbnS4AXTgUQaJFkfJWBIJJAiCZgvw D3cAfxUxxKlzzItlUv4dL/44pUU5IqUeIImsOVFxghOa8gd2HEAsDbElT516EcRwND CxQlmqj0qPnACku5G0mFHN4UsNlqXKci+T8oKveKul2LXT71PFg3eIw6dq4j5vp4MW uC4K7Il/vWg6we+yzExvxCaF8+u5yVkWzBBC695sEvH8iAswkvgJjF8tdWhQjEOCi8 drv0by5SDsvHCHvGj7UNBDiLY/BjhYpYRnPzeSRUFkj3IQnRbhhrIQKrcHmoL0jul/ lr6YmT7gLBgsg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Sam Ravnborg , Ulf Magnusson , Randy Dunlap , "Luis R . Rodriguez" , Tony Luck , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH v3 01/11] kbuild: add PYTHON2 and PYTHON3 variables Date: Tue, 13 Mar 2018 18:12:02 +0900 Message-Id: <1520932332-2449-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520932332-2449-1-git-send-email-yamada.masahiro@socionext.com> References: <1520932332-2449-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.x and 3.x scripts are used in one source tree. 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. One exception to this is scripts that are deliberately written to be source compatible with both Python 2.x and 3.x. Such scripts may continue to use python on their shebang line without affecting their portability. To meet this requirement, this commit adds new variables 'PYTHON2' and 'PYTHON3'. arch/ia64/scripts/unwcheck.py is the only script that has ever used $(PYTHON). Recent commit bd5edbe67794 ("ia64: convert unwcheck.py to python3") converted it to be compatible with both Python 2.x and 3.x, so this is the exceptional case where the use of 'python' is allowed. So, I did not touch arch/ia64/Makefile. tools/perf/Makefile.config sets PYTHON and PYTHON2 by itself, so it is not affected by this commit. Signed-off-by: Masahiro Yamada --- Changes in v3: - Keep PYTHON as-is because ia64 recently converted its script compatible with Python 3.x Changes in v2: - Add backward compatibility for PYTHON Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/Makefile b/Makefile index e02d092..7a5f85e 100644 --- a/Makefile +++ b/Makefile @@ -385,6 +385,8 @@ INSTALLKERNEL := installkernel DEPMOD = /sbin/depmod PERL = perl PYTHON = python +PYTHON2 = python2 +PYTHON3 = python3 CHECK = sparse CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ @@ -430,7 +432,7 @@ GCC_PLUGINS_CFLAGS := export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP HOSTLDFLAGS HOST_LOADLIBES -export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON UTS_MACHINE +export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS