diff options
| -rw-r--r-- | sphinx/application.py | 13 | ||||
| -rw-r--r-- | sphinx/extension.py (renamed from sphinx/extensions.py) | 10 |
2 files changed, 12 insertions, 11 deletions
diff --git a/sphinx/application.py b/sphinx/application.py index 043d2b793..fc8e0aa86 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -28,7 +28,7 @@ from docutils.parsers.rst import convert_directive_function, \ directives, roles import sphinx -from sphinx import package_dir, locale, extensions +from sphinx import package_dir, locale from sphinx.config import Config from sphinx.errors import SphinxError, ExtensionError, VersionRequirementError, \ ConfigError @@ -37,6 +37,7 @@ from sphinx.domains.std import GenericObject, Target, StandardDomain from sphinx.deprecation import RemovedInSphinx17Warning, RemovedInSphinx20Warning from sphinx.environment import BuildEnvironment from sphinx.events import EventManager +from sphinx.extension import load_extension, verify_required_extensions from sphinx.io import SphinxStandaloneReader from sphinx.locale import _ from sphinx.roles import XRefRole @@ -58,7 +59,7 @@ if False: from sphinx.builders import Builder # NOQA from sphinx.domains import Domain, Index # NOQA from sphinx.environment.collectors import EnvironmentCollector # NOQA - from sphinx.extensions import Extension # NOQA + from sphinx.extension import Extension # NOQA builtin_extensions = ( 'sphinx.builders.applehelp', @@ -213,7 +214,7 @@ class Sphinx(object): self.config.init_values() # check extension versions if requested - extensions.confirm(self, self.config.needs_extensions) + verify_required_extensions(self, self.config.needs_extensions) # check primary_domain if requested if self.config.primary_domain and self.config.primary_domain not in self.domains: @@ -446,11 +447,11 @@ class Sphinx(object): # ---- general extensibility interface ------------------------------------- - def setup_extension(self, extension): + def setup_extension(self, extname): # type: (unicode) -> None """Import and setup a Sphinx extension module. No-op if called twice.""" - logger.debug('[app] setting up extension: %r', extension) - extensions.load(self, extension) + logger.debug('[app] setting up extension: %r', extname) + load_extension(self, extname) def require_sphinx(self, version): # type: (unicode) -> None diff --git a/sphinx/extensions.py b/sphinx/extension.py index d976014f6..12e80d1a2 100644 --- a/sphinx/extensions.py +++ b/sphinx/extension.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ - sphinx.extensions - ~~~~~~~~~~~~~~~~~ + sphinx.extension + ~~~~~~~~~~~~~~~~ Utilities for Sphinx extensions. @@ -51,7 +51,7 @@ class Extension(object): self.parallel_write_safe = kwargs.pop('parallel_read_safe', True) -def load(app, extname): +def load_extension(app, extname): # type: (Sphinx, unicode) -> None """Load a Sphinx extension.""" if extname in app.extensions: # alread loaded @@ -99,9 +99,9 @@ def load(app, extname): app._setting_up_extension.pop() -def confirm(app, requirements): +def verify_required_extensions(app, requirements): # type: (Sphinx, Dict[unicode, unicode]) -> None - """Confirm the expected Sphinx extensions are loaded.""" + """Verify the required Sphinx extensions are loaded.""" if requirements is None: return |
