Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override
@ 2025-11-07 18:29 Jean Delvare
  2025-11-07 18:43 ` Nathan Chancellor
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jean Delvare @ 2025-11-07 18:29 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Nathan Chancellor, Nicolas Schier, Mauro Carvalho Chehab

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 run $(KERNELDOC) so that the desired version of
python is used.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
Changes in v2:
 * Leave KERNELDOC alone and patch the calling sites instead.

 drivers/gpu/drm/Makefile      |    2 +-
 drivers/gpu/drm/i915/Makefile |    2 +-
 include/drm/Makefile          |    2 +-
 scripts/Makefile.build        |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

--- linux-6.17.orig/drivers/gpu/drm/Makefile
+++ linux-6.17/drivers/gpu/drm/Makefile
@@ -244,7 +244,7 @@ always-$(CONFIG_DRM_HEADER_TEST) += \
 quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
       cmd_hdrtest = \
 		$(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \
-		 PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
+		 PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
 		touch $@
 
 $(obj)/%.hdrtest: $(src)/%.h FORCE
--- linux-6.17.orig/drivers/gpu/drm/i915/Makefile
+++ linux-6.17/drivers/gpu/drm/i915/Makefile
@@ -411,7 +411,7 @@ obj-$(CONFIG_DRM_I915_GVT_KVMGT) += kvmg
 #
 # Enable locally for CONFIG_DRM_I915_WERROR=y. See also scripts/Makefile.build
 ifdef CONFIG_DRM_I915_WERROR
-    cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none -Werror $<
+    cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none -Werror $<
 endif
 
 # header test
--- linux-6.17.orig/include/drm/Makefile
+++ linux-6.17/include/drm/Makefile
@@ -11,7 +11,7 @@ always-$(CONFIG_DRM_HEADER_TEST) += \
 quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
       cmd_hdrtest = \
 		$(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \
-		PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
+		PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
 		touch $@
 
 $(obj)/%.hdrtest: $(src)/%.h FORCE
--- linux-6.17.orig/scripts/Makefile.build
+++ linux-6.17/scripts/Makefile.build
@@ -167,7 +167,7 @@ else ifeq ($(KBUILD_CHECKSRC),2)
 endif
 
 ifneq ($(KBUILD_EXTRA_WARN),)
-  cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(KDOCFLAGS) \
+  cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \
         $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
         $<
 endif


-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override
  2025-11-07 18:29 [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override Jean Delvare
@ 2025-11-07 18:43 ` Nathan Chancellor
  2025-11-07 20:40 ` Mauro Carvalho Chehab
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2025-11-07 18:43 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-kbuild, Nicolas Schier, Mauro Carvalho Chehab

On Fri, Nov 07, 2025 at 07:29:33PM +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 run $(KERNELDOC) so that the desired version of
> python is used.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> ---

Thanks, I can take this as a fix for 6.18 since it results in warnings
in your environment. I will give it a day or so for folks to comment for
review.

> Changes in v2:
>  * Leave KERNELDOC alone and patch the calling sites instead.
> 
>  drivers/gpu/drm/Makefile      |    2 +-
>  drivers/gpu/drm/i915/Makefile |    2 +-
>  include/drm/Makefile          |    2 +-
>  scripts/Makefile.build        |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> --- linux-6.17.orig/drivers/gpu/drm/Makefile
> +++ linux-6.17/drivers/gpu/drm/Makefile
> @@ -244,7 +244,7 @@ always-$(CONFIG_DRM_HEADER_TEST) += \
>  quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
>        cmd_hdrtest = \
>  		$(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \
> -		 PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
> +		 PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
>  		touch $@
>  
>  $(obj)/%.hdrtest: $(src)/%.h FORCE
> --- linux-6.17.orig/drivers/gpu/drm/i915/Makefile
> +++ linux-6.17/drivers/gpu/drm/i915/Makefile
> @@ -411,7 +411,7 @@ obj-$(CONFIG_DRM_I915_GVT_KVMGT) += kvmg
>  #
>  # Enable locally for CONFIG_DRM_I915_WERROR=y. See also scripts/Makefile.build
>  ifdef CONFIG_DRM_I915_WERROR
> -    cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none -Werror $<
> +    cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none -Werror $<
>  endif
>  
>  # header test
> --- linux-6.17.orig/include/drm/Makefile
> +++ linux-6.17/include/drm/Makefile
> @@ -11,7 +11,7 @@ always-$(CONFIG_DRM_HEADER_TEST) += \
>  quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
>        cmd_hdrtest = \
>  		$(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \
> -		PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
> +		PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
>  		touch $@
>  
>  $(obj)/%.hdrtest: $(src)/%.h FORCE
> --- linux-6.17.orig/scripts/Makefile.build
> +++ linux-6.17/scripts/Makefile.build
> @@ -167,7 +167,7 @@ else ifeq ($(KBUILD_CHECKSRC),2)
>  endif
>  
>  ifneq ($(KBUILD_EXTRA_WARN),)
> -  cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(KDOCFLAGS) \
> +  cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \
>          $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
>          $<
>  endif
> 
> 
> -- 
> Jean Delvare
> SUSE L3 Support

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override
  2025-11-07 18:29 [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override Jean Delvare
  2025-11-07 18:43 ` Nathan Chancellor
@ 2025-11-07 20:40 ` Mauro Carvalho Chehab
  2025-11-08 11:20 ` Nicolas Schier
  2025-11-09  2:57 ` Nathan Chancellor
  3 siblings, 0 replies; 5+ messages in thread
From: Mauro Carvalho Chehab @ 2025-11-07 20:40 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-kbuild, Nathan Chancellor, Nicolas Schier

Em Fri, 7 Nov 2025 19:29:33 +0100
Jean Delvare <jdelvare@suse.de> escreveu:

> 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 run $(KERNELDOC) so that the desired version of
> python is used.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

> ---
> Changes in v2:
>  * Leave KERNELDOC alone and patch the calling sites instead.
> 
>  drivers/gpu/drm/Makefile      |    2 +-
>  drivers/gpu/drm/i915/Makefile |    2 +-
>  include/drm/Makefile          |    2 +-
>  scripts/Makefile.build        |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> --- linux-6.17.orig/drivers/gpu/drm/Makefile
> +++ linux-6.17/drivers/gpu/drm/Makefile
> @@ -244,7 +244,7 @@ always-$(CONFIG_DRM_HEADER_TEST) += \
>  quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
>        cmd_hdrtest = \
>  		$(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \
> -		 PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
> +		 PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
>  		touch $@
>  
>  $(obj)/%.hdrtest: $(src)/%.h FORCE
> --- linux-6.17.orig/drivers/gpu/drm/i915/Makefile
> +++ linux-6.17/drivers/gpu/drm/i915/Makefile
> @@ -411,7 +411,7 @@ obj-$(CONFIG_DRM_I915_GVT_KVMGT) += kvmg
>  #
>  # Enable locally for CONFIG_DRM_I915_WERROR=y. See also scripts/Makefile.build
>  ifdef CONFIG_DRM_I915_WERROR
> -    cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none -Werror $<
> +    cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none -Werror $<
>  endif
>  
>  # header test
> --- linux-6.17.orig/include/drm/Makefile
> +++ linux-6.17/include/drm/Makefile
> @@ -11,7 +11,7 @@ always-$(CONFIG_DRM_HEADER_TEST) += \
>  quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
>        cmd_hdrtest = \
>  		$(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \
> -		PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
> +		PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
>  		touch $@
>  
>  $(obj)/%.hdrtest: $(src)/%.h FORCE
> --- linux-6.17.orig/scripts/Makefile.build
> +++ linux-6.17/scripts/Makefile.build
> @@ -167,7 +167,7 @@ else ifeq ($(KBUILD_CHECKSRC),2)
>  endif
>  
>  ifneq ($(KBUILD_EXTRA_WARN),)
> -  cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(KDOCFLAGS) \
> +  cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(PYTHON3) $(KERNELDOC) -none $(KDOCFLAGS) \
>          $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
>          $<
>  endif
> 
> 



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override
  2025-11-07 18:29 [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override Jean Delvare
  2025-11-07 18:43 ` Nathan Chancellor
  2025-11-07 20:40 ` Mauro Carvalho Chehab
@ 2025-11-08 11:20 ` Nicolas Schier
  2025-11-09  2:57 ` Nathan Chancellor
  3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2025-11-08 11:20 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-kbuild, Nathan Chancellor, Mauro Carvalho Chehab

On Fri, Nov 07, 2025 at 07:29:33PM +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 run $(KERNELDOC) so that the desired version of
> python is used.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> ---
> Changes in v2:
>  * Leave KERNELDOC alone and patch the calling sites instead.
> 
>  drivers/gpu/drm/Makefile      |    2 +-
>  drivers/gpu/drm/i915/Makefile |    2 +-
>  include/drm/Makefile          |    2 +-
>  scripts/Makefile.build        |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 

Thanks.

Reviewed-by: Nicolas Schier <nsc@kernel.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override
  2025-11-07 18:29 [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override Jean Delvare
                   ` (2 preceding siblings ...)
  2025-11-08 11:20 ` Nicolas Schier
@ 2025-11-09  2:57 ` Nathan Chancellor
  3 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2025-11-09  2:57 UTC (permalink / raw)
  To: linux-kbuild, Jean Delvare
  Cc: Nathan Chancellor, Nicolas Schier, Mauro Carvalho Chehab


On Fri, 07 Nov 2025 19:29:33 +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 run $(KERNELDOC) so that the desired version of
> python is used.
> 
> [...]

Applied, thanks!

[1/1] Makefile: Let kernel-doc.py use PYTHON3 override
      https://git.kernel.org/kbuild/c/002621a4df3c1

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-09  2:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-07 18:29 [PATCH v2] Makefile: Let kernel-doc.py use PYTHON3 override Jean Delvare
2025-11-07 18:43 ` Nathan Chancellor
2025-11-07 20:40 ` Mauro Carvalho Chehab
2025-11-08 11:20 ` Nicolas Schier
2025-11-09  2:57 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox