Added check for index.rst
Some checks failed
gl/check check status: failure (6fa5c76e94fbcc4b4b053b35ab00dd8508b7eb37)

This commit is contained in:
2023-04-18 11:41:06 +00:00
parent b5a501185d
commit 6fa5c76e94

View File

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