From patchwork Tue Feb 6 00:34:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 126931 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2441190ljc; Mon, 5 Feb 2018 16:38:46 -0800 (PST) X-Google-Smtp-Source: AH8x224QVTHWZAmJHmiD2ox7AelglVUg2Z9nU+UFQ213dYyN9lZ/U1t6GCjzqo53jsWBw+Spnkx9 X-Received: by 10.98.63.15 with SMTP id m15mr551539pfa.221.1517877525976; Mon, 05 Feb 2018 16:38:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517877525; cv=none; d=google.com; s=arc-20160816; b=WanqFaEzzDvFXVdQDie9SZO/O2eOj/b98rURy/CeECQYrxGVEyJ1catL03Y/6HK9Wa UkYNDajdmBnbCjFi7dzmr+J5MBscp7vftuW/EV8pEZUHJId3fVk7PiH3bXUVESyUeu7g v88rwDqoBjLDDWRl+v+cZUh8aAz61NDfV0aLGnXpmD1hM9c2wqOxWlgLyIh+H5fiYkbN HSHjA0YE+4kDdy3q3MEG69WsDDqDNMXsIJugdiIl/7ots8RZYP5i6sAgVUTKsWtjgaZI SRmsQBVBGIbuO22oqlfKcFz4zlTVcklDi3vE6rZobQaCgh5yDVs6snhPxibwORsnC3Lw yWuw== 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=Noha0QiW63Ao007jCcFxnie6IMNyESx6eW/jUS2GKCc=; b=a0UA5TUGof2fSP+DMrbl6IJc+zYXoQyrAYIFEYtXg4QH5cBOG7RIWvzHf9AGGs8qMo 00GMjg3vhCDCEg72qd2h3503hc0yCD7nqzB+D3iJCT/MbpIDC5J4WOZR9cf4lyLQdaZK 9OAJZSHkJAJA8oPrxfMQJIkd0cM/UymCp9YkEeunN78kVGuFcSlG4+6mbIr/s4DxQC9E DtF8Pqy8GZPem+BTPsRKeCQR4mDsHoAB1T0bd7+DyzvbQmiDRpuAxI8VEz69Fd0IUPlR SYv9Cw92YHZdDOMX/DwOcBrZEBnfqsuEavOqSF9AEjTof0VBD9k6LcVeXovQr2KHhpak 3OUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=YHWqHF4x; 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 s8si4262968pgv.654.2018.02.05.16.38.45; Mon, 05 Feb 2018 16:38:45 -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=YHWqHF4x; 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 S1752537AbeBFAim (ORCPT + 21 others); Mon, 5 Feb 2018 19:38:42 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:40191 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752406AbeBFAiG (ORCPT ); Mon, 5 Feb 2018 19:38:06 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-07.nifty.com with ESMTP id w160ZHAl011351; Tue, 6 Feb 2018 09:35:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w160ZHAl011351 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1517877324; bh=Noha0QiW63Ao007jCcFxnie6IMNyESx6eW/jUS2GKCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YHWqHF4xnUzqKT76DKypbfh9q7SBI4Y+bMKt+sljXn/FBo9+05A0Z9nGhJB/nU1il cWAAsCJIBSaci8Asw+n4VxuC2zn1JSYjmdtV9XGWWABhTM6Pc0EU7+GGAaSmhgrXyX 6WY4CqWEVJ7OuzlteDSwD1SBRzdyCVSc9ey32B3Dz9Rjy2KBtq6ZrHwjTBIrLRnMZv sKe0GHR0tE2hRaShhXc7ctBKOHU8neL5GhX0SJUW+06ssM1gc64bwKjHt0yvbCEkwu Eu5fEBNriAnOhMNcu4APY3ku1LUEyhyO/rdY4BIad5tM96/sJwq8TquC1oNjG/Waxp nJBBJqa2IkWXA== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Greg Kroah-Hartman , Andrew Morton , Nicolas Pitre , "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Michal Marek , Linus Torvalds , Masahiro Yamada , Tony Luck , linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, Fenghua Yu Subject: [PATCH 06/14] kbuild: define PYTHON2 and PYTHON3 variables instead of PYTHON Date: Tue, 6 Feb 2018 09:34:46 +0900 Message-Id: <1517877294-4826-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517877294-4826-1-git-send-email-yamada.masahiro@socionext.com> References: <1517877294-4826-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 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(-) -- 2.7.4 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 CHECK = sparse CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ @@ -430,7 +431,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 PYTHON2 PYTHON3 UTS_MACHINE export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 2dd7f51..862a2ba 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile @@ -75,7 +75,7 @@ vmlinux.gz: vmlinux $(Q)$(MAKE) $(build)=$(boot) $@ unwcheck: vmlinux - -$(Q)READELF=$(READELF) $(PYTHON) $(srctree)/arch/ia64/scripts/unwcheck.py $< + -$(Q)READELF=$(READELF) $(PYTHON2) $(srctree)/arch/ia64/scripts/unwcheck.py $< archclean: $(Q)$(MAKE) $(clean)=$(boot)