From: Thomas Ilsche <thomas.ilsche@tu-dresden.de>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@kernel.org>, Paul Mackerras <paulus@samba.org>,
Namhyung Kim <namhyung.kim@lge.com>,
LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@redhat.com>
Subject: Re: [PATCH 2/2] perf tools: Default to python version 2
Date: Fri, 25 Jul 2014 13:43:24 +0200 [thread overview]
Message-ID: <53D242DC.9070503@tu-dresden.de> (raw)
In-Reply-To: <87wqb1ivnb.fsf@sejong.aot.lge.com>
[-- Attachment #1: Type: text/plain, Size: 3210 bytes --]
Hi Namhyung,
apologies for mixing up your first name earlier.
On 2014-07-25 12:24, Namhyung Kim wrote:
> Hi Thomas,
>
> On Fri, 25 Jul 2014 11:28:55 +0200, Thomas Ilsche wrote:
>> Hi Kim,
>>
>> On 2014-07-25 05:14, Namhyung Kim wrote:
>>> According to PEP 394 recommendation [1], it's more portable to use
>>> python2 rather than plain python to refer python binary version 2.
>>
>> I tried to find out how backwards-compatible this is. python2(-config)
>> was first available in Python 2.7.3 (April 2012), but it is still not
>> available in 2.6.9 (Oct. 2013). So it might be better to use python2
>> as default but fall back to python if python2 is not available.
>>
>> Best,
>> Thomas
>>
>> Signed-off-by: Thomas Ilsche <thomas.ilsche@tu-dresden.de>
>> ---
>> diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
>> index f4f7f58..1b1bc9c 100644
>> --- a/tools/perf/config/Makefile
>> +++ b/tools/perf/config/Makefile
>> @@ -117,8 +117,8 @@ ifdef PARSER_DEBUG
>> endif
>>
>> ifndef NO_LIBPYTHON
>> - override PYTHON := \
>> - $(call get-executable-or-default,PYTHON,python)
>> + PYTHON2 := $(call get-executable-or-default,PYTHON,python2)
>
> But wouldn't it set PYTHON2 to python2 even if the system doesn't have
> python2 actually?
>
>
>> + override PYTHON := $(if $(PYTHON2),$(PYTHON2),$(call get-executable,python))
>
> And then it'll set PYTHON to python2, no?
>
No, get-executable-or-default only returns anything if it is an actual executable
(asserted by a 'command -v' and 'test -f $ -a -x $'). At least this is how I understand
the Makefile code. I also tested it with a Python 2.6.9 (no python2 in path) and it worked
(after fixing some totally unrelated issues in python headers). It will however complain
that "The path 'python2' is not executable." before using python.
>
>> override PYTHON_CONFIG := \
>> $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
>
>
> I'm thinking about something like below.. but sadly it doesn't work for
> me.. hmm.
Actually this appears to work for me (with 2.6.9 & 2.7.6) and I find this solution more
elegant.
Best,
Thomas
>
> Thanks,
> Namhyung
>
>
>
> diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
> index 0f4b7fbc4852..60177278a357 100644
> --- a/tools/perf/config/Makefile
> +++ b/tools/perf/config/Makefile
> @@ -121,8 +121,8 @@ ifdef PARSER_DEBUG
> endif
>
> ifndef NO_LIBPYTHON
> - override PYTHON := \
> - $(call get-executable-or-default,PYTHON,python2)
> + PYTHON2 := $(if $(call get-executable,python2),python2,python)
> + override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
> override PYTHON_CONFIG := \
> $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
>
>
--
Dipl. Inf. Thomas Ilsche
Computer Scientist
Highly Adaptive Energy-Efficient Computing
CRC 912 HAEC: http://tu-dresden.de/sfb912
Technische Universität Dresden
Center for Information Services and High Performance Computing (ZIH)
01062 Dresden, Germany
Phone: +49 351 463-42168
Fax: +49 351 463-3773
E-Mail: thomas.ilsche@tu-dresden.de
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5015 bytes --]
next prev parent reply other threads:[~2014-07-25 11:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-24 16:36 Perf: cannot overide PYTHON(_CONFIG) Thomas Ilsche
2014-07-25 3:14 ` [PATCH 1/2] perf tools: Fix make PYTHON override Namhyung Kim
2014-07-25 3:14 ` [PATCH 2/2] perf tools: Default to python version 2 Namhyung Kim
2014-07-25 9:28 ` Thomas Ilsche
2014-07-25 10:24 ` Namhyung Kim
2014-07-25 11:43 ` Thomas Ilsche [this message]
2014-07-28 0:06 ` Namhyung Kim
2014-07-28 11:11 ` Thomas Ilsche
2014-07-29 6:38 ` Namhyung Kim
2014-07-25 7:23 ` [PATCH 1/2] perf tools: Fix make PYTHON override Thomas Ilsche
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=53D242DC.9070503@tu-dresden.de \
--to=thomas.ilsche@tu-dresden.de \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
/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