Linux Trace Kernel
 help / color / mirror / Atom feed
From: Ben Hutchings <benh@debian.org>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Tomas Glozar <tglozar@redhat.com>
Cc: linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: [PATCH 3/3] perf tools: Put Python bytecode in output directory
Date: Thu, 21 May 2026 16:35:46 +0200	[thread overview]
Message-ID: <ag8YQmHiaFc8Hpb-@decadent.org.uk> (raw)
In-Reply-To: <ag8X7gcDw6jpJsLq@decadent.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]

The PMU events are processed into C sources by Python scripts, which
normally results in writing bytecode for each module into the source
tree.  This prevents a fully out-of-tree build.

To fix this, set $PYTHONPYCACHEPREFIX to relocate the bytecode cache
directory in an out-of-tree build.

Signed-off-by: Ben Hutchings <benh@debian.org>
---
 tools/perf/Makefile.perf | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 899a4249a42f..c35b65f9fdda 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -400,6 +400,11 @@ PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
 PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
 export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 
+# Put Python bytecode in output directory
+ifdef OUTPUT
+export PYTHONPYCACHEPREFIX := $(OUTPUT)/__pycache__
+endif
+
 python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
 
 # Use the detected configuration

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2026-05-21 14:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 14:34 [PATCH 0/3] Fix out-of-tree build of some tools Ben Hutchings
2026-05-21 14:35 ` [PATCH 1/3] rtla: Fix output files in source tree Ben Hutchings
2026-05-21 14:48   ` Steven Rostedt
2026-05-21 14:35 ` [PATCH 2/3] perf tools: Put Python egg info in output directory Ben Hutchings
2026-05-21 14:35 ` Ben Hutchings [this message]
2026-05-21 17:50 ` [PATCH 0/3] Fix out-of-tree build of some tools Ian Rogers

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=ag8YQmHiaFc8Hpb-@decadent.org.uk \
    --to=benh@debian.org \
    --cc=acme@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglozar@redhat.com \
    /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