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"]])
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,13 +190,18 @@ def process_repositories(args, service):
"w",
encoding="utf-8") as out:
out.write(conf_py_content)
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 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, "index.rst"))
if args.update_tox:
context = dict(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)