* [PATCH] tools: perf: Avoid error message when building with no python installed @ 2015-07-27 15:50 Pawel Moll 2015-07-27 18:36 ` Jiri Olsa 0 siblings, 1 reply; 4+ messages in thread From: Pawel Moll @ 2015-07-27 15:50 UTC (permalink / raw) To: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Jiri Olsa, Namhyung Kim, Adrian Hunter Cc: linux-kernel, Pawel Moll When run on a system without a python interpreter installed, the makefile probing python will try to execute /bin/sh -c 'command -v -config [...]' instead of /bin/sh -c 'command -v python-config [...]' resulting in the following error message: sh: 1: command: Illegal option -c Although harmless, the message can be quite confusing and hard to track. Signed-off-by: Pawel Moll <pawel.moll@arm.com> --- tools/perf/config/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 094ddae..b4a9c29 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -150,7 +150,7 @@ ifndef NO_LIBPYTHON 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) + $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)) override PYTHON_CONFIG := \ $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) -- 2.1.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tools: perf: Avoid error message when building with no python installed 2015-07-27 15:50 [PATCH] tools: perf: Avoid error message when building with no python installed Pawel Moll @ 2015-07-27 18:36 ` Jiri Olsa 2015-07-28 12:49 ` Pawel Moll 0 siblings, 1 reply; 4+ messages in thread From: Jiri Olsa @ 2015-07-27 18:36 UTC (permalink / raw) To: Pawel Moll Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Namhyung Kim, Adrian Hunter, linux-kernel On Mon, Jul 27, 2015 at 04:50:55PM +0100, Pawel Moll wrote: > When run on a system without a python interpreter installed, the makefile > probing python will try to execute > > /bin/sh -c 'command -v -config [...]' > > instead of > > /bin/sh -c 'command -v python-config [...]' > > resulting in the following error message: > > sh: 1: command: Illegal option -c > > Although harmless, the message can be quite confusing and hard to track. > > Signed-off-by: Pawel Moll <pawel.moll@arm.com> > --- > tools/perf/config/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile > index 094ddae..b4a9c29 100644 > --- a/tools/perf/config/Makefile > +++ b/tools/perf/config/Makefile > @@ -150,7 +150,7 @@ ifndef NO_LIBPYTHON > 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) > + $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)) > override PYTHON_CONFIG := \ > $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) haven't tried, but seems like we want to add also the else part to get default into PYTHON_CONFIG? it fails anyway later either way, but seems like the 'python-config' was the default case that was meant to fail later jirka --- diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index f04f92093e37..7cf71a4d3a1f 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -150,7 +150,7 @@ ifndef NO_LIBPYTHON PYTHON2 := $(if $(call get-executable,python2),python2,python) override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2)) PYTHON2_CONFIG := \ - $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)) + $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config),python-config) override PYTHON_CONFIG := \ $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tools: perf: Avoid error message when building with no python installed 2015-07-27 18:36 ` Jiri Olsa @ 2015-07-28 12:49 ` Pawel Moll 2015-07-28 13:44 ` Jiri Olsa 0 siblings, 1 reply; 4+ messages in thread From: Pawel Moll @ 2015-07-28 12:49 UTC (permalink / raw) To: Jiri Olsa Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Namhyung Kim, Adrian Hunter, linux-kernel@vger.kernel.org On Mon, 2015-07-27 at 19:36 +0100, Jiri Olsa wrote: > > @@ -150,7 +150,7 @@ ifndef NO_LIBPYTHON > > 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) > > + $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)) > > override PYTHON_CONFIG := \ > > $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) > > haven't tried, but seems like we want to add also the else part > to get default into PYTHON_CONFIG? > - $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)) > + $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config),python-config) It's not strictly necessary, because the issue here is just executing "command -v -c" (followed by "onfig" :-), but of course it will still work. > it fails anyway later either way, but seems like the 'python-config' > was the default case that was meant to fail later Well, yes, I had the same impression. But at the same time get-executable-or-default is constructed in such a way that either of the variants must be a real executable: --8<----------- # get-supplied-or-default-executable # # Usage: absolute-executable-path-or-empty = $(call get-executable-or-default,variable,default) # define get-executable-or-default $(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2))) endef _ge_attempt = $(if $(get-executable),$(get-executable),$(call _gea_err,$(2))) _gea_err = $(if $(1),$(error Please set '$(1)' appropriately)) --8<----------- See? Both alternatives in the $(if $($(1)) monster do _ge_attempt... So one could say that the change may rather look like this (untested): --8<----------- diff --git a/tools/perf/config/utilities.mak b/tools/perf/config/utilities.mak index 0ebef09..78135dc 100644 --- a/tools/perf/config/utilities.mak +++ b/tools/perf/config/utilities.mak @@ -173,7 +173,7 @@ _ge-abspath = $(if $(is-executable),$(1)) # Usage: absolute-executable-path-or-empty = $(call get-executable-or-default,variable,default) # define get-executable-or-default -$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2))) +$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(2)) endef _ge_attempt = $(if $(get-executable),$(get-executable),$(call _gea_err, $(2))) _gea_err = $(if $(1),$(error Please set '$(1)' appropriately)) --8<----------- Pawel ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tools: perf: Avoid error message when building with no python installed 2015-07-28 12:49 ` Pawel Moll @ 2015-07-28 13:44 ` Jiri Olsa 0 siblings, 0 replies; 4+ messages in thread From: Jiri Olsa @ 2015-07-28 13:44 UTC (permalink / raw) To: Pawel Moll Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar, Namhyung Kim, Adrian Hunter, linux-kernel@vger.kernel.org On Tue, Jul 28, 2015 at 01:49:12PM +0100, Pawel Moll wrote: > On Mon, 2015-07-27 at 19:36 +0100, Jiri Olsa wrote: > > > @@ -150,7 +150,7 @@ ifndef NO_LIBPYTHON > > > 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) > > > + $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)) > > > override PYTHON_CONFIG := \ > > > $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) > > > > haven't tried, but seems like we want to add also the else part > > to get default into PYTHON_CONFIG? > > - $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)) > > + $(if $(PYTHON),$(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config),python-config) > > It's not strictly necessary, because the issue here is just executing > "command -v -c" (followed by "onfig" :-), but of course it will still > work. > > > it fails anyway later either way, but seems like the 'python-config' > > was the default case that was meant to fail later > > Well, yes, I had the same impression. But at the same time > get-executable-or-default is constructed in such a way that either of > the variants must be a real executable: > > --8<----------- > # get-supplied-or-default-executable > # > # Usage: absolute-executable-path-or-empty = $(call get-executable-or-default,variable,default) > # > define get-executable-or-default > $(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2))) > endef > _ge_attempt = $(if $(get-executable),$(get-executable),$(call _gea_err,$(2))) > _gea_err = $(if $(1),$(error Please set '$(1)' appropriately)) > --8<----------- > > See? Both alternatives in the $(if $($(1)) monster do _ge_attempt... So > one could say that the change may rather look like this (untested): > > --8<----------- > diff --git a/tools/perf/config/utilities.mak > b/tools/perf/config/utilities.mak > index 0ebef09..78135dc 100644 > --- a/tools/perf/config/utilities.mak > +++ b/tools/perf/config/utilities.mak > @@ -173,7 +173,7 @@ _ge-abspath = $(if $(is-executable),$(1)) > # Usage: absolute-executable-path-or-empty = $(call > get-executable-or-default,variable,default) > # > define get-executable-or-default > -$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2))) > +$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(2)) > endef > _ge_attempt = $(if $(get-executable),$(get-executable),$(call _gea_err, > $(2))) > _gea_err = $(if $(1),$(error Please set '$(1)' appropriately)) hum right.. looks like pythom is the only caller, nice jirka ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-07-28 13:44 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-07-27 15:50 [PATCH] tools: perf: Avoid error message when building with no python installed Pawel Moll 2015-07-27 18:36 ` Jiri Olsa 2015-07-28 12:49 ` Pawel Moll 2015-07-28 13:44 ` Jiri Olsa
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox