# HG changeset patch # User Vincent Hatakeyama <vincent.hatakeyama@xcg-consulting.fr> # Date 1679561899 -3600 # Thu Mar 23 09:58:19 2023 +0100 # Branch 15.0 # Node ID 76b180030261f0b742ce5bc4841c8eab88c01f19 # Parent 957b1e0c6bbcf02bfacca6d4b5800a75e158e780 📚 fix documentation generation diff --git a/doc/autotodo.py b/doc/autotodo.py --- a/doc/autotodo.py +++ b/doc/autotodo.py @@ -22,7 +22,7 @@ import os import os.path import sys -from typing import Dict, Mapping, Tuple +from collections.abc import Mapping def main(): @@ -99,8 +99,9 @@ res[tag].extend(info) -def scan_file(filename, tags) -> Tuple[Dict[str, Tuple[str, int, str]], int]: +def scan_file(filename, tags) -> tuple[dict[str, tuple[str, int, str]], int]: res = {tag: [] for tag in tags} + line_num: int = 0 with open(filename, "r") as f: for line_num, line in enumerate(f): for tag in tags: diff --git a/doc/conf.py b/doc/conf.py --- a/doc/conf.py +++ b/doc/conf.py @@ -33,7 +33,7 @@ "sphinx.ext.todo", "sphinx.ext.coverage", "sphinx.ext.graphviz", - "sphinxodoo.ext.autodoc", + "sphinxodooautodoc.ext.autodoc", ] # Add any paths that contain templates here, relative to this directory. @@ -145,18 +145,20 @@ # -# odoo-sphinx-autodoc +# sphinx-odoo-autodoc # -# sphinxodoo_addons: List of addons name to load (if empty, no addon will be +# sphinxodooautodoc_addons : List of addons name to load (if empty, no addon will be # loaded) this_module = os.path.basename( os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ) -sphinxodoo_addons = [this_module] -# sphinxodoo_root_path : Path of the Odoo root directory -sphinxodoo_root_path = os.path.dirname(os.path.dirname(os.path.abspath(odoo.__file__))) -# sphinxodoo_addons_path : List of paths were Odoo addons to load are located +sphinxodooautodoc_addons = [this_module] +# sphinxodooautodoc_root_path : Path of the Odoo root directory +sphinxodooautodoc_root_path = os.path.dirname( + os.path.dirname(os.path.abspath(odoo.__file__)) +) +# sphinxodooautodoc_addons_path : List of paths were Odoo addons to load are located c = None # find setup file of superproject, if any directory = os.path.dirname(os.getenv("PWD")) @@ -167,7 +169,7 @@ c.read(setup_path) if c.has_section("odoo_scripts"): # reload with odoo_scripts - c = Configuration(setup_path) + c = Configuration(directory) else: c = None if not c: @@ -176,17 +178,19 @@ else: directory = None -sphinxodoo_addons_path = [] +sphinxodooautodoc_addons_path = list() if c: addon_dirs = set(os.path.dirname(path) for path in c.modules) for line in addon_dirs: - sphinxodoo_addons_path.append(os.path.join(directory, line)) + sphinxodooautodoc_addons_path.append(os.path.join(directory, line)) else: # add this directory top dir - sphinxodoo_addons_path.append(os.path.dirname(os.path.dirname(os.getenv("PWD")))) + sphinxodooautodoc_addons_path.append( + os.path.dirname(os.path.dirname(os.getenv("PWD"))) + ) other_addons = os.getenv("ODOO_ADDONS_PATH", default=None) if other_addons: for addon_path in other_addons.split(","): - sphinxodoo_addons_path.append(addon_path) + sphinxodooautodoc_addons_path.append(addon_path)