From: sashiko-bot@kernel.org
To: "Ben Hutchings" <benh@debian.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 3/3] perf tools: Put Python bytecode in output directory
Date: Thu, 21 May 2026 15:18:44 +0000 [thread overview]
Message-ID: <20260521151844.B5CBB1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <ag8YQmHiaFc8Hpb-@decadent.org.uk>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The use of `PYTHONPYCACHEPREFIX` fails to resolve out-of-tree build pollution for Python 3.6 and 3.7.
- [Low] The newly configured relocated Python bytecode cache directory (`$(OUTPUT)/__pycache__`) is not removed during `make clean` or `make python-clean`.
--
commit 7f6b9146d44a693c3114eaae7826841344f49ebd
Author: Ben Hutchings <benh@debian.org>
perf tools: Put Python bytecode in output directory
This commit sets PYTHONPYCACHEPREFIX during perf tool builds when an output
directory is specified. This aims to prevent Python from writing bytecode
into the source tree during out-of-tree builds.
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -399,6 +399,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__
[Severity: Medium]
Since the perf build system explicitly supports Python 3.6 and 3.7, does
setting PYTHONPYCACHEPREFIX resolve the out-of-tree build pollution for
those versions?
This environment variable was introduced in Python 3.8 and is silently
ignored in earlier versions. Would exporting PYTHONDONTWRITEBYTECODE=1 be a
more universally supported alternative?
> +endif
> +
> python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf*.so
[Severity: Low]
Does the newly configured relocated Python bytecode cache directory need to
be explicitly removed in the python-clean target?
The existing clean rules do not match the deep absolute paths created by
PYTHONPYCACHEPREFIX, which leaves the entire __pycache__ directory hierarchy
orphaned in the build output after a make clean.
> # Use the detected configuration
--
Sashiko AI review · https://sashiko.dev/#/patchset/ag8X7gcDw6jpJsLq@decadent.org.uk?part=3
next prev parent reply other threads:[~2026-05-21 15:18 UTC|newest]
Thread overview: 8+ 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:53 ` sashiko-bot
2026-05-21 14:35 ` [PATCH 2/3] perf tools: Put Python egg info in output directory Ben Hutchings
2026-05-21 14:35 ` [PATCH 3/3] perf tools: Put Python bytecode " Ben Hutchings
2026-05-21 15:18 ` sashiko-bot [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=20260521151844.B5CBB1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=benh@debian.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.