From ef7bfdb6c85a4ef9cd1fe886d3dd569c472a0860 Mon Sep 17 00:00:00 2001
From: Xavier Robin <xavier.robin@unibas.ch>
Date: Thu, 19 Dec 2019 14:50:18 +0100
Subject: [PATCH] Attempt to restore compatibility with older versions of
 Sphinx

---
 doc/make.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/doc/make.py b/doc/make.py
index 426ee6028..cc6cc1feb 100644
--- a/doc/make.py
+++ b/doc/make.py
@@ -5,7 +5,12 @@ import shutil
 from ost import settings
 from optparse import OptionParser
 import subprocess
-import sphinx.cmd.build
+try:
+    # Import for new versions of Sphinx (tested with 2.3.0)
+    from sphinx.cmd.build import main as sphinx_main
+except ImportError:
+    # Import for older versions of Sphinx (should work with 1.6.7)
+    from sphinx import main as sphinx_main
 
 if len(sys.argv)==2:
   root_dir=sys.argv[1]
@@ -91,14 +96,14 @@ for sub_dir in ('modules',):
     _CollectRstDocs('doc/source', directory, filenames)
 
 if opts.html:
-  sphinx.cmd.build.main(extra_opts + ['-b', 'html', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
+  sphinx_main(extra_opts + ['-b', 'html', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
 
 if opts.doctest:
-  sphinx.cmd.build.main(extra_opts + ['-b', 'doctest', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
+  sphinx_main(extra_opts + ['-b', 'doctest', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
 
 if opts.build_json:
-  sphinx.cmd.build.main(extra_opts + ['-b', 'json', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
+  sphinx_main(extra_opts + ['-b', 'json', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
 
 if opts.linkcheck:
-  sphinx.cmd.build.main(extra_opts + ['-b', 'linkcheck', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
+  sphinx_main(extra_opts + ['-b', 'linkcheck', '-c', 'doc/conf', 'doc/source', 'doc/build/html'])
 
-- 
GitLab