New template and options for Service-Based-View #61

Merged
zuul merged 15 commits from template_sbv into main 2023-04-20 13:10:19 +00:00
3 changed files with 70 additions and 1 deletions
Showing only changes of commit 6fa5c76e94 - Show all commits

View File

@ -159,6 +159,7 @@ def process_repositories(args, service):
repo_to.index.add([doc["rst_location"]])
if args.update_sbv:
copy_path = pathlib.Path(copy_to, 'doc', 'source')
context = dict(
repo_name=target_repo["repo"],
project=service["service_title"],
@ -166,7 +167,6 @@ def process_repositories(args, service):
title=f"{service['service_title']} - Service Based View",
service_type=service["service_type"]
)
copy_path = pathlib.Path(copy_to, 'doc', 'source')
if not copy_path.exists():
logging.info("Path for sbv does not exist")
copy_path.mkdir(parents=True, exist_ok=True)
@ -190,14 +190,19 @@ def process_repositories(args, service):
"w",
encoding="utf-8") as out:
out.write(conf_py_content)
repo_to.index.add(pathlib.Path(copy_path, "conf.py"))
if not args.overwrite_index_sbv and pathlib.Path(copy_path, "index.rst").exists():
logging.info("File index.rst for sbv exists. Skipping")
else:
with open(
pathlib.Path(copy_path, "index.rst"),
"w",
encoding="utf-8") as out:
out.write(index_sbv_content)
repo_to.index.add(pathlib.Path(copy_path, "conf.py"))
repo_to.index.add(pathlib.Path(copy_path, "index.rst"))
if args.update_tox:
context = dict(docs=[])
for doc in service_docs:
@ -313,6 +318,11 @@ def main():
action="store_true",
help="Whether to update service-based-view"
)
parser.add_argument(
"--overwrite-index-sbv",
action="store_true",
help="Whether to overwrite index.rst for service-based-view"
)
args = parser.parse_args()
logging.basicConfig(level=logging.DEBUG)