From nobody Sat Oct 4 16:17:01 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 47E3A2877FA; Fri, 15 Aug 2025 11:37:26 +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=1755257846; cv=none; b=pAQ7nBHSO9UXHhEkwb1IbM8oVDcQ8eE8NwKB7Eyc2F/0SHgY2xCBnKzHAoFIx5YDvzWiviCnN6lRP8YNrqCiazX81Bd2MBqN0D8j8uzGvyQ6fmd3DywfiZZjACDb5ObCDzodykVulq/kYxCo+0CwYFcFnGDOZTwl4CI9Bv+BpIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755257846; c=relaxed/simple; bh=x7MW3bRve0BOOp4971V2uJ3c3u7EbdqpTM9d9SjBZLs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mg9eABHvCbD8JOlX8CPNR0wSBvSIruUJY/CtJ3oSiDeJ09PE7fUPxY8FNRUQqmuDUGNAvfoKhJLWBsXalrZax9CFMhWo984X8BrpUjLh0nl2iI2TfgHmWOi5xOwYPAvGgHwRLmjLb7XTYvUBRrbL0+Yym+po3XxkzCk9tnPnWnc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m1KeOAvS; 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="m1KeOAvS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0606C4CEF5; Fri, 15 Aug 2025 11:37:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1755257845; bh=x7MW3bRve0BOOp4971V2uJ3c3u7EbdqpTM9d9SjBZLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m1KeOAvS3r3Q4dPyVQdSrawwkVjsICuOoJwjEygIdbsVlELusUsHS1Wf+iQv1Iivb S2ixF27n4WTIrQ+x5EDNinCvEGHYfvzRm3DfQSf4uDsAIgs09RsA1EmG+Pnqi5eoTz 6MsGcjavkZBHL0NjgEk8CQWsVk+qkJx9M3YOVcmhZ6DIg6rbtskdIrUG8OiKuw9m8u Qsu9L2Sr3jQU6cBPpOS6ukauSExINjEMblv1KVxxZgiwmljgMjexEMB3Qep0EeiaAO ANS0Gm8I6ROiwbBQ6ffPllBfzwK/aMUhc+Rb978gi5Cpp/o7dI4uYyxlDZW6YrYog1 dm1lk61LhBFZw== Received: from mchehab by mail.kernel.org with local (Exim 4.98.2) (envelope-from ) id 1umskN-000000042T1-4B7h; Fri, 15 Aug 2025 13:37:24 +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 02/11] docs: conf.py: better handle latex documents Date: Fri, 15 Aug 2025 13:36:18 +0200 Message-ID: <6856916fe21b4ad31c692517b4a7fcb3bd320935.1755256868.git.mchehab+huawei@kernel.org> 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