diff --git a/tools/generate_doc_confpy.py b/tools/generate_doc_confpy.py index 58f657a1..e60edd1b 100644 --- a/tools/generate_doc_confpy.py +++ b/tools/generate_doc_confpy.py @@ -155,6 +155,34 @@ def process_repositories(args, service): out.write(conf_py_content) repo_to.index.add([doc["rst_location"]]) + + if args.update_sbv: + context = dict( + repo_name=target_repo["repo"], + project=service["service_title"], + # pdf_name=doc["pdf_name"], + 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) + context["otc_sbv"] = True + if git_fqdn: + context["git_fqdn"] = git_fqdn + if target_repo.get("type") != "github": + context["git_type"] = target_repo["type"] + if args.target_environment == "internal": + context["html_options"] = dict( + disable_search=True, + site_name="Internal Documentation Portal", + 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: + out.write(conf_py_content) + if args.update_tox: context = dict(docs=[]) for doc in service_docs: @@ -265,6 +293,11 @@ 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", + help="Whether to update service-based-view" + ) args = parser.parse_args() logging.basicConfig(level=logging.DEBUG)