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

:books: fix documentation generation

parent 5751236a
No related branches found
No related tags found
No related merge requests found
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
@echo @echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
autotodo: autotodo: autotodo.py
@python autotodo.py ../ .py TODO,FIXME,XXX @./autotodo.py ../ .py TODO,FIXME,XXX
manifest: ../__manifest__.py manifest.py manifest: ../__manifest__.py manifest.py
...@@ -195,3 +195,3 @@ ...@@ -195,3 +195,3 @@
manifest: ../__manifest__.py manifest.py manifest: ../__manifest__.py manifest.py
@python manifest.py @./manifest.py
# -*- coding: utf-8 -*- #!/usr/bin/env python3
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2014 XCG Consulting # Copyright (C) 2014, 2018 XCG Consulting
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
tags = sys.argv[3].split(",") tags = sys.argv[3].split(",")
todolist = {tag: [] for tag in tags} todolist = {tag: [] for tag in tags}
os.path.walk(folder, scan_folder, (exts, tags, todolist)) for root, dirs, files in os.walk(folder):
scan_folder((exts, tags, todolist), root, files)
create_autotodo(folder, todolist) create_autotodo(folder, todolist)
...@@ -63,7 +64,8 @@ ...@@ -63,7 +64,8 @@
"\t\t:language: python\n" "\t\t:language: python\n"
"\t\t:lines: %s-%s\n" "\t\t:lines: %s-%s\n"
"\t\t:emphasize-lines: %s\n" "\t\t:emphasize-lines: %s\n"
% ( %
(
class_name, class_name,
"-" * len(class_name), "-" * len(class_name),
line, line,
...@@ -85,8 +87,8 @@ ...@@ -85,8 +87,8 @@
write_info(f, info, folder) write_info(f, info, folder)
def scan_folder(xxx_todo_changeme, dirname, names): def scan_folder(data_tuple, dirname, names):
(exts, tags, res) = xxx_todo_changeme (exts, tags, res) = data_tuple
file_info = {} file_info = {}
for name in names: for name in names:
(root, ext) = os.path.splitext(name) (root, ext) = os.path.splitext(name)
......
...@@ -306,6 +306,4 @@ ...@@ -306,6 +306,4 @@
# If true, do not generate a @detailmenu in the "Top" node's menu. # If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False # texinfo_no_detailmenu = False
todo_include_todos = True
# Example configuration for intersphinx: refer to the Python standard library. # Example configuration for intersphinx: refer to the Python standard library.
...@@ -311,8 +309,8 @@ ...@@ -311,8 +309,8 @@
# Example configuration for intersphinx: refer to the Python standard library. # Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {"https://docs.python.org/2/": None} intersphinx_mapping = {"https://docs.python.org/3/": None}
# #
# odoo-sphinx-autodoc # odoo-sphinx-autodoc
# #
...@@ -313,11 +311,11 @@ ...@@ -313,11 +311,11 @@
# #
# odoo-sphinx-autodoc # odoo-sphinx-autodoc
# #
# sphinxodoo_addons : List of addons name to load (if empty, no addon will be loaded) # sphinxodoo_addons: Names of addons to load
this_module = os.path.basename( this_module = os.path.basename(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))) os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
) )
sphinxodoo_addons = [this_module] sphinxodoo_addons = [this_module]
...@@ -320,8 +318,8 @@ ...@@ -320,8 +318,8 @@
this_module = os.path.basename( this_module = os.path.basename(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))) os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
) )
sphinxodoo_addons = [this_module] sphinxodoo_addons = [this_module]
# sphinxodoo_root_path : Path of the Odoo root directory # sphinxodoo_root_path: Path of the Odoo root directory
sphinxodoo_root_path = os.path.dirname( sphinxodoo_root_path = os.path.dirname(
os.path.dirname(os.path.abspath(odoo.__file__)) os.path.dirname(os.path.abspath(odoo.__file__))
) )
...@@ -325,9 +323,9 @@ ...@@ -325,9 +323,9 @@
sphinxodoo_root_path = os.path.dirname( sphinxodoo_root_path = os.path.dirname(
os.path.dirname(os.path.abspath(odoo.__file__)) os.path.dirname(os.path.abspath(odoo.__file__))
) )
# sphinxodoo_addons_path : List of paths were Odoo addons to load are located # sphinxodoo_addons_path: List of paths were Odoo addons to load are located
superproject_path = os.path.dirname( superproject_path = os.path.dirname(
os.path.dirname(os.path.dirname(os.getenv("PWD"))) os.path.dirname(os.path.dirname(os.getenv("PWD")))
) )
c = configparser.ConfigParser() c = configparser.ConfigParser()
c.read(os.path.join(superproject_path, "setup.cfg")) c.read(os.path.join(superproject_path, "setup.cfg"))
...@@ -329,7 +327,7 @@ ...@@ -329,7 +327,7 @@
superproject_path = os.path.dirname( superproject_path = os.path.dirname(
os.path.dirname(os.path.dirname(os.getenv("PWD"))) os.path.dirname(os.path.dirname(os.getenv("PWD")))
) )
c = configparser.ConfigParser() c = configparser.ConfigParser()
c.read(os.path.join(superproject_path, "setup.cfg")) c.read(os.path.join(superproject_path, "setup.cfg"))
sphinxodoo_addons_path = [os.path.join(sphinxodoo_root_path, "addons")] sphinxodoo_addons_path = []
...@@ -335,3 +333,7 @@ ...@@ -335,3 +333,7 @@
for line in c.get("odoo_scripts", "addon_dirs", "").splitlines(): addon_dirs = set(
os.path.dirname(path)
for path in c.get("odoo_scripts", "modules").split())
for line in addon_dirs:
sphinxodoo_addons_path.append(os.path.join(superproject_path, line)) sphinxodoo_addons_path.append(os.path.join(superproject_path, line))
#!/usr/bin/env python #!/usr/bin/env python3
############################################################################### ###############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
############################################################################### ###############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2016 XCG Consulting (http://www.xcg-consulting.fr/) # Copyright (C) 2016, 2018 XCG Consulting (http://www.xcg-consulting.fr/)
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
...@@ -18,4 +18,5 @@ ...@@ -18,4 +18,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################### ###############################################################################
import os
...@@ -21,5 +22,5 @@ ...@@ -21,5 +22,5 @@
import ast from odoo.modules import load_information_from_description_file
def main(): def main():
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
def main(): def main():
with open("../__manifest__.py", "r") as f: module = os.path.basename(os.path.dirname(os.path.dirname(
read_data = f.read() os.path.realpath(__file__))))
d = ast.literal_eval(read_data) d = load_information_from_description_file(module)
with open("manifest", "w") as out: with open("manifest", "w") as out:
...@@ -29,5 +30,9 @@ ...@@ -29,5 +30,9 @@
with open("manifest", "w") as out: with open("manifest", "w") as out:
out.write(d["description"]) manifest_content = (
d["description"]
if "description" in d
else d["summary"] if "summary" in d else "")
out.write(manifest_content)
if __name__ == "__main__": if __name__ == "__main__":
......
sphinx
git+https://github.com/OCA/odoo-sphinx-autodoc#egg=odoo-sphinx-autodoc
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