From nobody Sat Oct 4 02:58:19 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9819F2EA755; Thu, 21 Aug 2025 08:17:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755764224; cv=none; b=BdCXz2QMt6r+ze8SQOxWse2ywATIcJCS9FDxSWGBfPOekqUGYJTB3iKfBi55sNNwzC8S2hFYWo1iB+yrTeLYVJzuUxNypIE2wImTsM/zacpkAFxBK4t5VrAbw8cyeemxjtKTt36gbj3g9pbaiwVJ1gpZiYheOt0ZeS+k7pc8Ico= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755764224; c=relaxed/simple; bh=x7MW3bRve0BOOp4971V2uJ3c3u7EbdqpTM9d9SjBZLs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IckyZqkBLeulE0vU8yO6ohcHTKqMs+etBqHmRFoXDUOOYWXUb9Cj9u3zjothDwX8sb3MKxR56+K2ZbWukw0cDGeTm/ynilaQPpoF+qJrnFqvMNE7ez1SV3mHn7wqNXJAfDhnWl8Bj3kbTYZVijoHhPgGB1jFPThQ4JWJ6HBr0Wk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Aq29AYcK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Aq29AYcK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EA2DC4AF09; Thu, 21 Aug 2025 08:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1755764224; bh=x7MW3bRve0BOOp4971V2uJ3c3u7EbdqpTM9d9SjBZLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aq29AYcK3/fmmD1mm67PX9D3SOq1g6qwRFR1B2cM4yrDtQy4M+eYCLzs5zn8Cwmww ZTzWFccbaHQ4gK/nzOcA1RY0DmF/mO8affn7NFkL7sOQ1M/E48UjJXg5K2CBriXrwR TazNrQCvI1Y0mhzVoGym9p5ecMAC+7oo0Hz8SK1FWBq4adyh7SwFnLpKkBJqP3SWWB lNwPZGxvhGCjgDrrP74CiVKwlLJVZGQ0SPPryUmJnIzatkaaAYUNriu55WUrFPWwEO GJeH8amUIBrFgZM9aQ7OwS9mCxdv1EDPaHSH1ho4ueyX0Vmz26g2EU/arzE5llBxEU 2OewrTHgmeczg== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1up0Tm-0000000BLg9-2WXv; Thu, 21 Aug 2025 10:17:02 +0200 From: Mauro Carvalho Chehab To: Jonathan Corbet , Linux Doc Mailing List Cc: Mauro Carvalho Chehab , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org Subject: [PATCH v2 02/14] docs: conf.py: better handle latex documents Date: Thu, 21 Aug 2025 10:16:38 +0200 Message-ID: X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" The original logic assumed that app.srcdir is identical to the current working dir. This is the case for a normal build, but, when SPHINXDIRS=3D"some dir" is used, this is not the case anymore. Adjust the logic to fill the LaTeX documents considering app.srcdir, in a way that it will work properly on all cases. Signed-off-by: Mauro Carvalho Chehab --- Documentation/conf.py | 54 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/Documentation/conf.py b/Documentation/conf.py index f9828f3862f9..2c1be59fd54b 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -51,11 +51,13 @@ else: dyn_exclude_patterns.append("devicetree/bindings/**.yaml") dyn_exclude_patterns.append("core-api/kho/bindings/**.yaml") =20 -# Properly handle include/exclude patterns -# ---------------------------------------- +# Properly handle directory patterns and LaTeX docs +# ------------------------------------------------- =20 -def update_patterns(app, config): +def config_init(app, config): """ + Initialize path-dependent variabled + On Sphinx, all directories are relative to what it is passed as SOURCEDIR parameter for sphinx-build. Due to that, all patterns that have directory names on it need to be dynamically set, after @@ -86,6 +88,25 @@ def update_patterns(app, config): =20 config.exclude_patterns.append(rel_path) =20 + # LaTeX and PDF output require a list of documents with are dependent + # of the app.srcdir. Add them here + + for fn in os.listdir(app.srcdir): + doc =3D os.path.join(fn, "index") + if not os.path.exists(os.path.join(app.srcdir, doc + ".rst")): + continue + + has =3D False + for l in latex_documents: + if l[0] =3D=3D doc: + has =3D True + break + + if not has: + latex_documents.append((doc, fn + ".tex", + "Linux %s Documentation" % fn.capitali= ze(), + "The kernel development community", + "manual")) =20 # helper # ------ @@ -456,32 +477,9 @@ latex_elements["preamble"] +=3D """ \\input{kerneldoc-preamble.sty} """ =20 -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -# Sorted in alphabetical order +# This will be filled up by config-inited event latex_documents =3D [] =20 -# Add all other index files from Documentation/ subdirectories -for fn in os.listdir("."): - doc =3D os.path.join(fn, "index") - if os.path.exists(doc + ".rst"): - has =3D False - for l in latex_documents: - if l[0] =3D=3D doc: - has =3D True - break - if not has: - latex_documents.append( - ( - doc, - fn + ".tex", - "Linux %s Documentation" % fn.capitalize(), - "The kernel development community", - "manual", - ) - ) - # The name of an image file (relative to this directory) to place at the t= op of # the title page. # latex_logo =3D None @@ -577,4 +575,4 @@ loadConfig(globals()) def setup(app): """Patterns need to be updated at init time on older Sphinx versions""" =20 - app.connect('config-inited', update_patterns) + app.connect('config-inited', config_init) --=20 2.50.1