From e9eeb5fda03b24bd9455963a8d2c40b7ac201ccd Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 24 Sep 2022 13:59:04 -0400 Subject: [PATCH] tool_docs: don't assume cwd is dfhack root hopefully fixes the CI docs build in dfhack/scripts --- docs/sphinx_extensions/dfhack/tool_docs.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/sphinx_extensions/dfhack/tool_docs.py b/docs/sphinx_extensions/dfhack/tool_docs.py index 18532c9d5..836bab217 100644 --- a/docs/sphinx_extensions/dfhack/tool_docs.py +++ b/docs/sphinx_extensions/dfhack/tool_docs.py @@ -225,7 +225,7 @@ def get_tags(): groups = {} group_re = re.compile(r'"([^"]+)"') tag_re = re.compile(r'- `([^ ]+) <[^>]+>`: (.*)') - with open('docs/Tags.rst') as f: + with open(os.path.join(dfhack.util.DOCS_ROOT, 'Tags.rst')) as f: lines = f.readlines() for line in lines: line = line.strip() @@ -285,10 +285,11 @@ def register_index(app, tag, title): app.add_index_to_domain(tag, index_class) def init_tag_indices(app): - os.makedirs('docs/tags', mode=0o755, exist_ok=True) + os.makedirs(os.path.join(dfhack.util.DOCS_ROOT, 'tags'), mode=0o755, exist_ok=True) tag_groups = get_tags() for tag_group in tag_groups: - with dfhack.util.write_file_if_changed(('docs/tags/by{group}.rst').format(group=tag_group)) as topidx: + group_file_path = os.path.join(dfhack.util.DOCS_ROOT, 'tags', 'by{group}.rst'.format(group=tag_group)) + with dfhack.util.write_file_if_changed(group_file_path) as topidx: for tag_tuple in tag_groups[tag_group]: tag, desc = tag_tuple[0], tag_tuple[1] topidx.write(('- `{name} <{name}-tag-index>`\n').format(name=tag))