python-sphinxcontrib-httpdo.../0003-httpdomain-autohttp-Use-app.setup_extension.patch
2017-07-24 11:47:00 +10:00

83 lines
2.9 KiB
Diff

From 8d0b0ecd213e668529b531f618e10e4eaadc6340 Mon Sep 17 00:00:00 2001
From: Dave Shawley <daveshawley@gmail.com>
Date: Tue, 27 Jun 2017 08:11:57 -0400
Subject: [PATCH 3/4] httpdomain/autohttp: Use app.setup_extension.
This method has been available since sphinx 1.0 so there is no need to wrap
this in "version safety" checks and it is significantly cleaner.
---
httpdomain/sphinxcontrib/autohttp/bottle.py | 3 +--
httpdomain/sphinxcontrib/autohttp/flask.py | 2 +-
httpdomain/sphinxcontrib/autohttp/flaskqref.py | 3 +--
httpdomain/sphinxcontrib/autohttp/tornado.py | 2 +-
httpdomain/sphinxcontrib/httpdomain.py | 7 -------
5 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/httpdomain/sphinxcontrib/autohttp/bottle.py b/httpdomain/sphinxcontrib/autohttp/bottle.py
index 306cadd..adf6c77 100644
--- a/httpdomain/sphinxcontrib/autohttp/bottle.py
+++ b/httpdomain/sphinxcontrib/autohttp/bottle.py
@@ -108,6 +108,5 @@ def run(self):
def setup(app):
- httpdomain.setup(app)
+ app.setup_extension('sphinxcontrib.httpdomain')
app.add_directive('autobottle', AutobottleDirective)
-
diff --git a/httpdomain/sphinxcontrib/autohttp/flask.py b/httpdomain/sphinxcontrib/autohttp/flask.py
index be65f35..b1fac45 100644
--- a/httpdomain/sphinxcontrib/autohttp/flask.py
+++ b/httpdomain/sphinxcontrib/autohttp/flask.py
@@ -43,5 +43,5 @@ def run(self):
def setup(app):
- httpdomain.setup(app)
+ app.setup_extension('sphinxcontrib.httpdomain')
app.add_directive('autoflask', AutoflaskDirective)
diff --git a/httpdomain/sphinxcontrib/autohttp/flaskqref.py b/httpdomain/sphinxcontrib/autohttp/flaskqref.py
index 3a70b4b..8f33d18 100644
--- a/httpdomain/sphinxcontrib/autohttp/flaskqref.py
+++ b/httpdomain/sphinxcontrib/autohttp/flaskqref.py
@@ -74,6 +74,5 @@ def run(self):
return node.children
def setup(app):
- httpdomain.setup(app)
+ app.setup_extension('sphinxcontrib.httpdomain')
app.add_directive('qrefflask', QuickReferenceFlaskDirective)
-
diff --git a/httpdomain/sphinxcontrib/autohttp/tornado.py b/httpdomain/sphinxcontrib/autohttp/tornado.py
index 8efd343..f844305 100644
--- a/httpdomain/sphinxcontrib/autohttp/tornado.py
+++ b/httpdomain/sphinxcontrib/autohttp/tornado.py
@@ -123,5 +123,5 @@ def run(self):
def setup(app):
- httpdomain.setup(app)
+ app.setup_extension('sphinxcontrib.httpdomain')
app.add_directive('autotornado', AutoTornadoDirective)
diff --git a/httpdomain/sphinxcontrib/httpdomain.py b/httpdomain/sphinxcontrib/httpdomain.py
index 6a25e2e..faa50f2 100644
--- a/httpdomain/sphinxcontrib/httpdomain.py
+++ b/httpdomain/sphinxcontrib/httpdomain.py
@@ -756,13 +756,6 @@ def content_callback(self, match):
def setup(app):
- try:
- if app.registry.has_domain(HTTPDomain.name):
- return
- except AttributeError:
- if HTTPDomain.name in app.domains:
- return
-
app.add_domain(HTTPDomain)
try:
--
2.9.4