[PATCH v3 2/2] perf tools: Default to python version 2

From: Thomas Ilsche
Date: Mon Aug 04 2014 - 09:03:37 EST


On 2014-08-02 15:20, Arnaldo Carvalho de Melo wrote:
> Maybe the way python was packaged on f14 is problematic, as you
> describe, but the fact is that python support is not working on that
> platform after this patch.
>
> Could you please try to prepare a patch that does as you suggest so that
> I can try?

Please try the patch below.
I tested (compiles and perf script runs) with the combinations:

1) python -> python2.x, python-config -> python2.x-config
python2 N/A, python2-config N/A

2) python -> python3.x, python-config -> python3.x-config
python2 -> python2.x, python2-config -> python2.x-config

3) python -> python2.x, python-config -> python2.x-config
python2 -> python2.x, python2-config -> python2.x-config

4) python -> python2.x, python-config -> python2.x-config
python2 -> python2.x, python2-config N/A

Based on / replaces the patch 2/2 by Namhyung Kim.

Signed-off-by: Thomas Ilsche <thomas.ilsche@xxxxxxxxxxxxx>
---
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 9ee2008..0528cd37 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -104,10 +104,16 @@ ifdef PARSER_DEBUG
endif

ifndef NO_LIBPYTHON
- override PYTHON := \
- $(call get-executable-or-default,PYTHON,python)
+ # Try different combinations to accommodate systems that only have
+ # python[2][-config] in weird combinations but always preferring
+ # python2 and python2-config as per pep-0394. If we catch a
+ # python[-config] in version 3, the version check will kill it.
+ PYTHON2 := $(if $(call get-executable,python2),python2,python)
+ override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
+ PYTHON2_CONFIG := \
+ $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
override PYTHON_CONFIG := \
- $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
+ $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))

PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/