public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pawel Moll <pawel.moll@arm.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tools: perf: Avoid error message when building with no python installed
Date: Tue, 28 Jul 2015 13:49:12 +0100	[thread overview]
Message-ID: <1438087752.2114.22.camel@arm.com> (raw)
In-Reply-To: <20150727183601.GE20509@krava.brq.redhat.com>

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


  reply	other threads:[~2015-07-28 12:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-07-28 13:44     ` Jiri Olsa

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=1438087752.2114.22.camel@arm.com \
    --to=pawel.moll@arm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.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