Newer
Older
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import ast
from odoo_scripts.config import Configuration
# 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
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath("."))
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.ifconfig",
"sphinx.ext.viewcode",
"sphinxodoo.ext.autodoc",
]
# Add any paths that contain templates here, relative to this directory.
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
with open(os.path.join("..", "__manifest__.py"), "r") as f:
read_data = f.read()
d = ast.literal_eval(read_data)
# The full version, including alpha/beta/rc tags.
version = ".".join(release.split(".")[:4])
# General information about the project.
copyright = "2018, 2022 XCG Consulting"
module_nospace = project.replace(" ", "")
module_description = d.get("summary", "")
module_lowercase = module_nospace.lower()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# The name of the Pygments (syntax highlighting) style to use.
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# Output file base name for HTML help builder.
htmlhelp_basename = "%sdoc" % module_nospace
# -- Options for LaTeX output ---------------------------------------------
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
"%s.tex" % module_nospace,
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, module_lowercase, "%s Documentation" % project, [author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
"AccountingPeriods",
author,
"AccountingPeriods",
"""
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/3/": None}
#
# odoo-sphinx-autodoc
#
# sphinxodoo_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
c = None
# find setup file of superproject, if any
directory = os.path.dirname(os.getenv("PWD"))
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"):
# reload with odoo_scripts
c = Configuration(setup_path)
else:
c = None
if not c:
if os.path.dirname(directory) != directory:
directory = os.path.dirname(directory)
else:
directory = None
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))