]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scripts/kernel-doc.py: don't create *.pyc files
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 24 Apr 2025 00:16:23 +0000 (08:16 +0800)
committerJonathan Corbet <corbet@lwn.net>
Thu, 24 Apr 2025 16:12:46 +0000 (10:12 -0600)
As reported by Andy, kernel-doc.py is creating a __pycache__
directory at build time.

Disable creation of __pycache__ for the libraries used by
kernel-doc.py, when excecuted via the build system or via
scripts/find-unused-docs.sh.

Reported-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Closes: https://lore.kernel.org/linux-doc/Z_zYXAJcTD-c3xTe@black.fi.intel.com/
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <158b962ed7cd104f7bbfe69f499ec1cc378864db.1745453655.git.mchehab+huawei@kernel.org>

drivers/gpu/drm/Makefile
drivers/gpu/drm/i915/Makefile
include/drm/Makefile
scripts/Makefile.build
scripts/find-unused-docs.sh

index ed54a546bbe2d5b0d106d44d42c295d6f3e3aa3b..d21d0cd2c75281b1f698b5cf81d2cbca7c973bb4 100644 (file)
@@ -236,7 +236,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 $<; \
-               $(srctree)/scripts/kernel-doc -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
+                PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
                touch $@
 
 $(obj)/%.hdrtest: $(src)/%.h FORCE
index ed05b131ed3abb3ea5e3b2bf67a1c6b929661be3..ab6b89a163e7e3d9c900d6983c93bc70b25522e2 100644 (file)
@@ -408,7 +408,7 @@ obj-$(CONFIG_DRM_I915_GVT_KVMGT) += kvmgt.o
 #
 # Enable locally for CONFIG_DRM_I915_WERROR=y. See also scripts/Makefile.build
 ifdef CONFIG_DRM_I915_WERROR
-    cmd_checkdoc = $(srctree)/scripts/kernel-doc -none -Werror $<
+    cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none -Werror $<
 endif
 
 # header test
index a7bd15d2803ef6ff110abea8c9cb897afb8b188c..1df6962556efc2c088bf5980ddb0822145b86067 100644 (file)
@@ -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 $<; \
-               $(srctree)/scripts/kernel-doc -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
+               PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
                touch $@
 
 $(obj)/%.hdrtest: $(src)/%.h FORCE
index 13dcd86e74ca830ce3fb2587df7f200105490881..884dc86ce04e6b5567226d622f09269dd2443ddc 100644 (file)
@@ -83,7 +83,7 @@ else ifeq ($(KBUILD_CHECKSRC),2)
 endif
 
 ifneq ($(KBUILD_EXTRA_WARN),)
-  cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $(KDOCFLAGS) \
+  cmd_checkdoc = PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(KDOCFLAGS) \
         $(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) \
         $<
 endif
index ee6a50e33aba805dfd1ea056adf24d80ebe8b283..d6d397fbf91718627399895cfe18ab8a1ecf70bd 100755 (executable)
@@ -54,7 +54,7 @@ for file in `find $1 -name '*.c'`; do
        if [[ ${FILES_INCLUDED[$file]+_} ]]; then
        continue;
        fi
-       str=$(scripts/kernel-doc -export "$file" 2>/dev/null)
+       str=$(PYTHONDONTWRITEBYTECODE=1 scripts/kernel-doc -export "$file" 2>/dev/null)
        if [[ -n "$str" ]]; then
        echo "$file"
        fi