lkml.org 
[lkml]   [2014]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH 2/2] perf tools: Default to python version 2
Date
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?


> 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.

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)


\
 
 \ /
  Last update: 2014-07-25 13:21    [W:0.106 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site