File tree 3 files changed +12
-5
lines changed
src/ansys_sphinx_theme/extension
3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change
1
+ fix: `` autoapi `` relative directory path wrt `` tox `` env
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi"
5
5
[project ]
6
6
# Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections
7
7
name = " ansys-sphinx-theme"
8
- version = " 1.0.8 "
8
+ version = " 1.0.9 "
9
9
description = " A theme devised by ANSYS, Inc. for Sphinx documentation."
10
10
readme = " README.rst"
11
11
requires-python = " >=3.9,<4"
Original file line number Diff line number Diff line change 23
23
"""Module containing an extension for creating Sphinx AutoAPI templates for the Ansys Sphinx Theme.""" # noqa: E501
24
24
25
25
import os
26
+ from pathlib import Path
26
27
from typing import Any , Dict
27
28
28
29
from sphinx .application import Sphinx
@@ -79,10 +80,15 @@ def prepare_jinja_env(jinja_env) -> None:
79
80
app .config ["autoapi_member_order" ] = autoapi .get ("member_order" , "bysource" )
80
81
81
82
# HACK: The ``autoapi_dirs`` should be given as a relative path to the conf.py.
82
- relative_autoapi_dir = os .path .relpath (
83
- autoapi .get ("directory" , "src/ansys" ), start = str (app .confdir / "conf.py" )
84
- )
85
- app .config ["autoapi_dirs" ] = [relative_autoapi_dir ]
83
+ autoapi_dir = autoapi .get ("directory" , "src/ansys" )
84
+ # assume the docs are in doc/source directory
85
+ root_dir = Path (app .srcdir ).resolve ().parent .parent
86
+ path_to_autoapi_dir = (root_dir / autoapi_dir ).resolve ()
87
+ if path_to_autoapi_dir .exists ():
88
+ relative_autoapi_dir = os .path .relpath (path_to_autoapi_dir , start = app .srcdir )
89
+ else :
90
+ relative_autoapi_dir = autoapi_dir
91
+ app .config ["autoapi_dirs" ] = [str (relative_autoapi_dir )]
86
92
87
93
88
94
def setup (app : Sphinx ) -> Dict [str , Any ]:
You can’t perform that action at this time.
0 commit comments