Docutils 0.4 doesn't provide the “Directive” class and Sphinx supplies
its own version which doesn't have the “assert_has_content” method.

Signed-off-by: Michael Hanselmann <[email protected]>
---
 lib/build/sphinx_ext.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lib/build/sphinx_ext.py b/lib/build/sphinx_ext.py
index 6594107..40d1a40 100644
--- a/lib/build/sphinx_ext.py
+++ b/lib/build/sphinx_ext.py
@@ -197,7 +197,11 @@ class PythonAssert(sphinx.util.compat.Directive):
   final_argument_whitespace = False
 
   def run(self):
-    self.assert_has_content()
+    # Handle combinations of Sphinx and docutils not providing the wanted 
method
+    if hasattr(self, "assert_has_content"):
+      self.assert_has_content()
+    else:
+      assert self.content
 
     code = "\n".join(self.content)
 
-- 
1.7.3.5

Reply via email to