add extension blacklist to avoid error when loading deprecated extensions

This commit is contained in:
Yoshiki Shibukawa
2016-06-01 15:32:24 +09:00
parent f147df3fa0
commit 88bf4373c7
2 changed files with 15 additions and 0 deletions

View File

@@ -69,6 +69,10 @@ events = {
CONFIG_FILENAME = 'conf.py'
ENV_PICKLE_FILENAME = 'environment.pickle'
# list of deprecated extensions. Keys are extension name.
# Values are Sphinx version that merge the extension.
EXTENSION_BLACKLIST = {"sphinxjp.themecore": "1.2"}
class Sphinx(object):
@@ -460,6 +464,11 @@ class Sphinx(object):
self.debug('[app] setting up extension: %r', extension)
if extension in self._extensions:
return
if extension in EXTENSION_BLACKLIST:
self.warn('the extension %r was already merged with Sphinx since version %s; '
'this extension is ignored.' % (
extension, EXTENSION_BLACKLIST[extension]))
return
self._setting_up_extension.append(extension)
try:
mod = __import__(extension, None, None, ['setup'])

View File

@@ -70,6 +70,12 @@ def test_extensions(app, status, warning):
assert warning.getvalue().startswith("WARNING: extension 'shutil'")
@with_app()
def test_extension_in_blacklist(app, status, warning):
app.setup_extension('sphinxjp.themecore')
assert warning.getvalue().startswith("WARNING: the extension 'sphinxjp.themecore' was")
@with_app()
def test_domain_override(app, status, warning):
class A(Domain):