From: Dmitry Shachnev <mitya57@debian.org>
Date: Wed, 25 Dec 2019 23:18:56 +0300
Subject: Remove references to sphinxcontrib modules

To avoid dependency loops (these packages depend on sphinx themselves).
---
 doc/usage/builders/index.rst | 24 ------------------------
 sphinx/application.py        | 13 +++++++++++--
 2 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/doc/usage/builders/index.rst b/doc/usage/builders/index.rst
index e293399..2625fe3 100644
--- a/doc/usage/builders/index.rst
+++ b/doc/usage/builders/index.rst
@@ -121,12 +121,6 @@ The most common builders are:
    also generates HTML Help support files that allow the Microsoft HTML Help
    Workshop to compile them into a CHM file.
 
-   .. autoattribute:: name
-
-   .. autoattribute:: format
-
-   .. autoattribute:: supported_image_types
-
 .. module:: sphinxcontrib.qthelp
 .. class:: QtHelpBuilder
 
@@ -138,12 +132,6 @@ The most common builders are:
 
       Moved to sphinxcontrib.qthelp from sphinx.builders package.
 
-   .. autoattribute:: name
-
-   .. autoattribute:: format
-
-   .. autoattribute:: supported_image_types
-
    .. _Qt help: https://doc.qt.io/qt-4.8/qthelp-framework.html
 
 .. module:: sphinxcontrib.applehelp
@@ -164,12 +152,6 @@ The most common builders are:
    output will not be valid until :program:`hiutil` has been run on all of the
    ``.lproj`` folders within the bundle.
 
-   .. autoattribute:: name
-
-   .. autoattribute:: format
-
-   .. autoattribute:: supported_image_types
-
    .. versionadded:: 1.3
 
    .. versionchanged:: 2.0
@@ -183,12 +165,6 @@ The most common builders are:
    also generates `GNOME Devhelp <https://wiki.gnome.org/Apps/Devhelp>`__
    support file that allows the GNOME Devhelp reader to view them.
 
-   .. autoattribute:: name
-
-   .. autoattribute:: format
-
-   .. autoattribute:: supported_image_types
-
    .. versionchanged:: 2.0
 
       Moved to sphinxcontrib.devhelp from sphinx.builders package.
diff --git a/sphinx/application.py b/sphinx/application.py
index fe0e8bd..154bfd2 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -19,7 +19,12 @@ from sphinx import locale, package_dir
 from sphinx._cli.util.colour import bold
 from sphinx.config import Config
 from sphinx.environment import BuildEnvironment
-from sphinx.errors import ApplicationError, ConfigError, VersionRequirementError
+from sphinx.errors import (
+    ApplicationError,
+    ConfigError,
+    ExtensionError,
+    VersionRequirementError,
+)
 from sphinx.events import EventManager
 from sphinx.highlighting import lexer_classes
 from sphinx.locale import __
@@ -131,7 +136,6 @@ _first_party_themes = (
     'alabaster',
 )
 builtin_extensions += _first_party_themes
-builtin_extensions += _first_party_extensions
 
 ENV_PICKLE_FILENAME = 'environment.pickle'
 
@@ -285,6 +289,11 @@ class Sphinx:
         # and first-party themes
         for extension in builtin_extensions:
             self.setup_extension(extension)
+        for extension in _first_party_extensions:
+            try:
+                self.setup_extension(extension)
+            except ExtensionError:
+                pass  # DEBIAN: Allow missing first-party extensions
 
         # load all user-given extension modules
         for extension in self.config.extensions:
