From patchwork Fri Apr 18 23:50:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 14057730 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA000C369AB for ; Fri, 18 Apr 2025 23:50:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90DE310E42E; Fri, 18 Apr 2025 23:50:43 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="GV65kiKF"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3605C10E2E8; Fri, 18 Apr 2025 23:50:40 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id F32C344E92; Fri, 18 Apr 2025 23:50:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B280C4CEE2; Fri, 18 Apr 2025 23:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745020238; bh=c5ICYBvBMQAPVgTj8nFGD8PU7cVGL/PCYMCLPDiK5Gc=; h=From:To:Cc:Subject:Date:From; b=GV65kiKFF+X9GzT4JIT/UUSoxT3SpDas8hBEq8A4jTKyqArNe7tVul4mT4qqajI8y yxdKRIosYX8ZBTP85HhUG5gLGKXtM6o/d47jM2eykngbIDxmTO7gTbMWGpNDD5d7Hm rmfXGWRhP9u3xj7GLRQsoICOKRRHe1XZbDtqtHwOnyN/045lHQCqPonn2j4K7GRRne 1yTjqGNpWgJGuZ++Dmbnjky05UP+nkGF7Ki01h5D+LYlmuaTiNn8ETcR5vmMMfxaJO vBrmzVCVnfSSnYfbtTxg/ifnifCNTlELVhjtIIFy8C3kPli7Ono4m/edreGrXjXbcN 7+nKBaVrmUd/Q== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1u5vTL-00000003KF5-36VJ; Sat, 19 Apr 2025 07:50:15 +0800 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet , David Airlie , Jani Nikula , Joonas Lahtinen , Maarten Lankhorst , Masahiro Yamada , Maxime Ripard , Nathan Chancellor , Nicolas Schier , Rodrigo Vivi , Simona Vetter , Thomas Zimmermann , Tvrtko Ursulin , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kbuild@vger.kernel.org Subject: [PATCH v3 0/4] Don't create Python bytecode when building the kernel Date: Sat, 19 Apr 2025 07:50:01 +0800 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" As reported by Andy, the Kernel build system runs kernel-doc script for DRM, when W=1. Due to Python's normal behavior, its JIT compiler will create a bytecode and store it under scripts/lib/*/__pycache__. As one may be using O= and even having the sources on a read-only mount point, disable its creation during build time. This is done by adding PYTHONDONTWRITEBYTECODE=1 on every place where the script is called within Kbuild and when called via another script. This only solves half of the issue though, as one may be manually running the script by hand, without asking Python to not store any bytecode. This should be OK, but afterwards, git status will list the __pycache__ as not committed. To prevent that, add *.pyc to .gitignore. This series contain 4 patches: - patch 1 adjusts a variable that pass extra data to scripts/kerneldoc.py; - patch 2moves scripts/kernel-doc location to the main makefile and exports it, as scripts/Makefile.build will need it; - patch 3 disables __pycache__ generation and ensure that the entire Kbuild will use KERNELDOC var for the location of kernel-doc; - patch 4 adds *.pyc at the list of object files to be ignored. Tested-by: Andy Shevchenko --- v3: - move KERNELDOC to the main Makefile; - get rid of the badly-named KERNELDOC_CONF var. v2: - added a .gitignore file; - add PYTHONDONTWRITEBYTECODE=1 to the places where kernel-doc is called. Mauro Carvalho Chehab (4): docs: Makefile: get rid of KERNELDOC_CONF env variable Makefile: move KERNELDOC macro to the main Makefile scripts/kernel-doc.py: don't create *.pyc files .gitignore: ignore Python compiled bytecode .gitignore | 1 + Documentation/Makefile | 5 ++--- Makefile | 5 +++++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/i915/Makefile | 2 +- include/drm/Makefile | 2 +- scripts/Makefile.build | 2 +- scripts/find-unused-docs.sh | 2 +- 8 files changed, 13 insertions(+), 8 deletions(-)