Skip to content
Snippets Groups Projects
Commit 76b180030261 authored by Vincent Hatakeyama's avatar Vincent Hatakeyama
Browse files

:books: fix documentation generation

parent 957b1e0c6bbc
Branches branch/15.0
No related tags found
1 merge request!23📚 fix documentation generation
Pipeline #52952 passed
......@@ -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,5 +99,5 @@
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}
......@@ -103,4 +103,5 @@
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:
......
......@@ -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,6 +145,6 @@
#
# odoo-sphinx-autodoc
# sphinx-odoo-autodoc
#
......@@ -149,7 +149,7 @@
#
# 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__)))
)
......@@ -152,11 +152,13 @@
# 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,9 +178,9 @@
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:
......@@ -180,8 +182,8 @@
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
......@@ -186,6 +188,8 @@
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(","):
......@@ -189,4 +193,4 @@
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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment