From 2fcdff101f888ac310969e4e5e0f2e409288a71d Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Thu, 13 Feb 2020 11:32:50 +0000
Subject: [PATCH] Fix sphinx8 script used by pep8

We wrap doc8 to register the directives we use in our documentation.
Previously the 'app' argument was passed as None, however sphinx has
started to use the argument.

This change uses a mock object since we don't need to use the
application object.

Change-Id: Id9e8d5f6d09f14d294cd493538780456f98c7dbe
---
 tools/sphinx8 | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/sphinx8 b/tools/sphinx8
index d6a9290c..2813fd8c 100755
--- a/tools/sphinx8
+++ b/tools/sphinx8
@@ -13,6 +13,7 @@ directives when any of the directives modules are imported.
 import sys
 
 import doc8.main
+import mock
 import sphinx.directives
 import sphinx.directives.code
 import sphinx.directives.patches
@@ -21,9 +22,12 @@ import sphinx.directives.patches
 def main():
     # NOTE: Registering sphinx.directives.other causes a failure in parsing
     # later.
-    sphinx.directives.setup(None)
-    sphinx.directives.code.setup(None)
-    sphinx.directives.patches.setup(None)
+    # Sphinx expects an 'app' argument to these functions. Use a mock since we
+    # don't need to use the application object.
+    app = mock.Mock()
+    sphinx.directives.setup(app)
+    sphinx.directives.code.setup(app)
+    sphinx.directives.patches.setup(app)
     return doc8.main.main()
 
 
-- 
GitLab