66import os
77import shutil
88from typing import Dict , Tuple
9- import warnings
109
1110import sphinx
1211from sphinx .util .console import colorize
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-
5647def _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 )
0 commit comments