File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
src/ansys_sphinx_theme/extension Expand file tree Collapse file tree 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"
55[project ]
66# Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections
77name = " ansys-sphinx-theme"
8- version = " 1.0.8 "
8+ version = " 1.0.9 "
99description = " A theme devised by ANSYS, Inc. for Sphinx documentation."
1010readme = " README.rst"
1111requires-python = " >=3.9,<4"
Original file line number Diff line number Diff line change 2323"""Module containing an extension for creating Sphinx AutoAPI templates for the Ansys Sphinx Theme.""" # noqa: E501
2424
2525import os
26+ from pathlib import Path
2627from typing import Any , Dict
2728
2829from sphinx .application import Sphinx
@@ -79,10 +80,15 @@ def prepare_jinja_env(jinja_env) -> None:
7980 app .config ["autoapi_member_order" ] = autoapi .get ("member_order" , "bysource" )
8081
8182 # 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 )]
8692
8793
8894def setup (app : Sphinx ) -> Dict [str , Any ]:
You can’t perform that action at this time.
0 commit comments