Skip to content

Commit d2a9675

Browse files
committed
Fix srcdir usage as a string for compatibility with Sphinx v8
Closes #457
1 parent 52043a8 commit d2a9675

File tree

3 files changed

+6
-30
lines changed

3 files changed

+6
-30
lines changed

autoapi/extension.py

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import os
77
import shutil
88
from typing import Dict, Tuple
9-
import warnings
109

1110
import sphinx
1211
from sphinx.util.console import colorize
@@ -45,14 +44,6 @@
4544
"""Caches a module's parse results for use in viewcode."""
4645

4746

48-
class RemovedInAutoAPI3Warning(DeprecationWarning):
49-
"""Indicates something that will be removed in sphinx-autoapi v3."""
50-
51-
52-
if "PYTHONWARNINGS" not in os.environ:
53-
warnings.filterwarnings("default", category=RemovedInAutoAPI3Warning)
54-
55-
5647
def _normalise_autoapi_dirs(autoapi_dirs, srcdir):
5748
normalised_dirs = []
5849

@@ -72,15 +63,6 @@ def run_autoapi(app):
7263
if not app.config.autoapi_dirs:
7364
raise ExtensionError("You must configure an autoapi_dirs setting")
7465

75-
if app.config.autoapi_include_summaries is not None:
76-
warnings.warn(
77-
"autoapi_include_summaries has been replaced by "
78-
"the show-module-summary AutoAPI option\n",
79-
RemovedInAutoAPI3Warning,
80-
)
81-
if app.config.autoapi_include_summaries:
82-
app.config.autoapi_options.append("show-module-summary")
83-
8466
own_page_level = app.config.autoapi_own_page_level
8567
if own_page_level not in _VALID_PAGE_LEVELS:
8668
raise ValueError(f"Invalid autoapi_own_page_level '{own_page_level}")
@@ -94,22 +76,14 @@ def run_autoapi(app):
9476
"Please check your `autoapi_dirs` setting."
9577
)
9678

79+
template_dir = app.config.autoapi_template_dir
80+
if template_dir and not os.path.isabs(template_dir):
81+
template_dir = os.path.join(app.srcdir, app.config.autoapi_template_dir)
82+
9783
normalized_root = os.path.normpath(
9884
os.path.join(app.srcdir, app.config.autoapi_root)
9985
)
10086
url_root = os.path.join("/", app.config.autoapi_root)
101-
102-
template_dir = app.config.autoapi_template_dir
103-
if template_dir and not os.path.isabs(template_dir):
104-
if not os.path.isdir(template_dir):
105-
template_dir = os.path.join(app.srcdir, app.config.autoapi_template_dir)
106-
elif app.srcdir != os.getcwd():
107-
warnings.warn(
108-
"autoapi_template_dir will be expected to be "
109-
"relative to the Sphinx source directory instead of "
110-
"relative to where sphinx-build is run\n",
111-
RemovedInAutoAPI3Warning,
112-
)
11387
sphinx_mapper_obj = Mapper(
11488
app, template_dir=template_dir, dir_root=normalized_root, url_root=url_root
11589
)

docs/changes/+7e9094d4.removal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed autoapi_include_summaries option. This was supposed to have been retired in v3

docs/changes/457.removal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed ability for autoapi_template_dir to be relative to cwd. This was supposed to have been retired in v3

0 commit comments

Comments
 (0)