Skip to content
Snippets Groups Projects

Backport 18.0 changes

Merged Vincent Hatakeyama requested to merge topic/17.0/backport into branch/17.0
2 files
+ 19
14
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 16
11
@@ -15,7 +15,7 @@
from importlib.metadata import version as import_version
import odoo # type: ignore[import-untyped]
from odoo_scripts.config import Configuration
from odoo_scripts.config import Configuration # type: ignore[import-untyped]
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -158,5 +158,5 @@
os.path.dirname(os.path.abspath(odoo.__file__))
)
# sphinxodooautodoc_addons_path : List of paths were Odoo addons to load are located
c = None
c: Configuration | None = None
# find setup file of superproject, if any
@@ -162,5 +162,10 @@
# find setup file of superproject, if any
directory = os.path.dirname(os.getenv("PWD"))
pwd = os.getenv("PWD")
directory: str | None
if pwd is not None:
directory = os.path.dirname(pwd)
else:
directory = None
while not c and directory:
setup_path = os.path.join(directory, "setup.cfg")
if os.path.isfile(setup_path):
@@ -164,9 +169,9 @@
while not c and directory:
setup_path = os.path.join(directory, "setup.cfg")
if os.path.isfile(setup_path):
c = configparser.ConfigParser()
c.read(setup_path)
if c.has_section("odoo_scripts"):
setup_cfg = configparser.ConfigParser()
setup_cfg.read(setup_path)
if setup_cfg.has_section("odoo_scripts"):
# reload with odoo_scripts
c = Configuration(directory)
else:
@@ -182,7 +187,8 @@
if c:
addon_dirs = set(os.path.dirname(path) for path in c.modules)
for line in addon_dirs:
sphinxodooautodoc_addons_path.append(os.path.join(directory, line))
if directory is not None:
for line in addon_dirs:
sphinxodooautodoc_addons_path.append(os.path.join(directory, line))
else:
# add this directory top dir
@@ -187,8 +193,7 @@
else:
# add this directory top dir
sphinxodooautodoc_addons_path.append(
os.path.dirname(os.path.dirname(os.getenv("PWD")))
)
if pwd is not None:
sphinxodooautodoc_addons_path.append(os.path.dirname(os.path.dirname(pwd)))
other_addons = os.getenv("ODOO_ADDONS_PATH", default=None)
if other_addons:
for addon_path in other_addons.split(","):
Loading