From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Nathan Chancellor <nathan@kernel.org>,
Jean Delvare <jdelvare@suse.de>,
Linux Documentation <linux-doc@vger.kernel.org>,
linux-kbuild@vger.kernel.org,
Nicolas Schier <nicolas.schier@linux.dev>
Subject: Re: [PATCH] Makefile: Let kernel-doc.py use PYTHON3 override
Date: Fri, 7 Nov 2025 07:13:42 -0300 [thread overview]
Message-ID: <20251107071342.52ed6437@sal.lan> (raw)
In-Reply-To: <c0e4a0b0-b7c9-491b-ada3-74945fb2e3d9@infradead.org>
Em Mon, 3 Nov 2025 11:00:51 -0800
Randy Dunlap <rdunlap@infradead.org> escreveu:
> Hi,
>
> On 11/3/25 10:56 AM, Nathan Chancellor wrote:
> > On Mon, Nov 03, 2025 at 01:14:19PM +0100, Jean Delvare wrote:
> >> It is possible to force a specific version of python to be used when
> >> building the kernel by passing PYTHON3= on the make command line.
> >> However kernel-doc.py is currently called with python3 hard-coded and
> >> thus ignores this setting.
> >>
> >> Use PYTHON3 to call kernel-doc.py so that the desired version of
> >> python is used.
> >>
> >> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> >
> > I see one use of KERNELDOC in tools/docs/sphinx-build-wrapper that would
> > appear to break with this change? Does it matter? I am not familiar with
> > the docs build. Otherwise, this seems like the correct thing to do.
>
> I think there has been some discussion of these matters on the linux-doc
> mailing list (adding it here).
Yes. The way the current building system works, after the discussions,
is that:
1. Makefile runs sphinx-build-wrapper, which is a python script, using
this target:
htmldocs mandocs infodocs texinfodocs latexdocs epubdocs xmldocs pdfdocs linkcheckdocs:
$(Q)PYTHONPYCACHEPREFIX="$(PYTHONPYCACHEPREFIX)" \
$(srctree)/tools/docs/sphinx-pre-install --version-check
+$(Q)PYTHONPYCACHEPREFIX="$(PYTHONPYCACHEPREFIX)" \
$(PYTHON3) $(BUILD_WRAPPER) $@ \
--sphinxdirs="$(SPHINXDIRS)" $(RUSTDOC) \
--builddir="$(BUILDDIR)" --deny-vf=$(FONTS_CONF_DENY_VF) \
--theme=$(DOCS_THEME) --css=$(DOCS_CSS) --paper=$(PAPER)
2. sphinx-build-wrapper will run sphinx-build with the same python
version it was called;
3. Sphinx kerneldoc.py extension will directly call kernel-doc
classes, meaning that it will use the same python version as
sphinx-build. There, it will use KERNELDOC var *only* to check if
it ends with ".py", as there is (still) a fallback code there to allow
running a different script via fork.
On other words, if one wants to run a different python version, it has
to do:
make PYTHON3=/usr/bin/python-3.11 htmldocs
This should work for doc builds.
Please notice, however, that kERNEL_DOC env var is also called at some
DRM makefiles. Perhaps the issue you're getting is there.
Regards,
Mauro
>
> >> ---
> >> Makefile | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> --- linux-6.17.orig/Makefile
> >> +++ linux-6.17/Makefile
> >> @@ -460,7 +460,7 @@ HOSTPKG_CONFIG = pkg-config
> >>
> >> # the KERNELDOC macro needs to be exported, as scripts/Makefile.build
> >> # has a logic to call it
> >> -KERNELDOC = $(srctree)/scripts/kernel-doc.py
> >> +KERNELDOC = $(PYTHON3) $(srctree)/scripts/kernel-doc.py
This is not the right place to add it, as it may break the Sphinx
extension.
> >> export KERNELDOC
> >>
> >> KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
> >>
> >>
> >> --
> >> Jean Delvare
> >> SUSE L3 Support
> >
>
next prev parent reply other threads:[~2025-11-07 10:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20251103131419.5e504ae2@endymion>
[not found] ` <20251103185609.GB672460@ax162>
2025-11-03 19:00 ` [PATCH] Makefile: Let kernel-doc.py use PYTHON3 override Randy Dunlap
2025-11-07 10:13 ` Mauro Carvalho Chehab [this message]
2025-11-07 18:26 ` Jean Delvare
2025-11-07 20:45 ` Mauro Carvalho Chehab
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=20251107071342.52ed6437@sal.lan \
--to=mchehab+huawei@kernel.org \
--cc=jdelvare@suse.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas.schier@linux.dev \
--cc=rdunlap@infradead.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;
as well as URLs for NNTP newsgroup(s).