mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #2613 from shibukawa/feature/extension-blacklist-to-stable
add extension blacklist to avoid error when loading deprecated extensions
This commit is contained in:
commit
cdb621440c
@ -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'])
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user