From c597690ecd3687801644462f11fa7677d024eaea Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Tue, 18 Apr 2023 08:30:44 +0000 Subject: [PATCH] Updated confpy template and tool --- otc_metadata/templates/conf.py.j2 | 6 +++++- tools/generate_doc_confpy.py | 13 ++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/otc_metadata/templates/conf.py.j2 b/otc_metadata/templates/conf.py.j2 index 859d3b87..12a83c93 100644 --- a/otc_metadata/templates/conf.py.j2 +++ b/otc_metadata/templates/conf.py.j2 @@ -17,8 +17,12 @@ import os import sys + extensions = [ - 'otcdocstheme' + 'otcdocstheme', +{%- if otc_sbv %} + 'otc_sphinx_directives' +{%- endif %} ] otcdocs_auto_name = False diff --git a/tools/generate_doc_confpy.py b/tools/generate_doc_confpy.py index e60edd1b..c3de76d3 100644 --- a/tools/generate_doc_confpy.py +++ b/tools/generate_doc_confpy.py @@ -164,10 +164,9 @@ def process_repositories(args, service): title=f"{service['service_title']} - Service Based View", ) copy_path = pathlib.Path(copy_to, 'doc', 'source') - print(copy_path) if not copy_path.exists(): logging.info("Path for sbv does not exist") - copy_path.parent.mkdir(parents=True, exist_ok=True) + copy_path.mkdir(parents=True, exist_ok=True) context["otc_sbv"] = True if git_fqdn: context["git_fqdn"] = git_fqdn @@ -180,8 +179,12 @@ def process_repositories(args, service): logo_url="https://docs-int.otc-service.com", ) conf_py_content = conf_py_template.render(**context) - with open(pathlib.Path(copy_path, "conf.py"), "w", encoding="utf-8") as out: + with open( + pathlib.Path(copy_path, "conf.py"), + "w", + encoding="utf-8") as out: out.write(conf_py_content) + repo_to.index.add(pathlib.Path(copy_path, "conf.py")) if args.update_tox: context = dict(docs=[]) @@ -294,8 +297,8 @@ def main(): parser.add_argument("--token", metavar="token", help="API token") parser.add_argument("--api-url", help="API base url of the Git hoster") parser.add_argument( - "--update_sbv", - action="store_true", + "--update-sbv", + action="store_true", help="Whether to update service-based-view" )