diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-08 04:31:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-08 04:32:50 +0300 |
commit | 0b4aeffda95dd991e1fb8e5d22e552a9f165f442 (patch) | |
tree | d7c659d6d53d118f9ae494268e3b9b85a2c9acc7 /doc | |
parent | 9c8334acc14fec3a4585a87ade6013543f7b5042 (diff) |
PyDoc: support building without sphinx_rtd_theme
This is no longer bundled with sphinx, support building without it.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/python_api/sphinx_doc_gen.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 4ea63740b3c..af7461263c8 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1672,15 +1672,26 @@ def write_sphinx_conf_py(basepath): fw("]\n\n") fw("html_title = 'Blender Python API'\n") - fw("html_theme = 'sphinx_rtd_theme'\n") - fw("html_theme_options = {\n") - fw(" 'canonical_url': 'https://docs.blender.org/api/current/',\n") - # fw(" 'analytics_id': '',\n") - # fw(" 'collapse_navigation': True,\n") - fw(" 'sticky_navigation': False,\n") - fw(" 'navigation_depth': 1,\n") - # fw(" 'includehidden': True,\n") - # fw(" 'titles_only': False\n") + + fw("html_theme = 'default'\n") + # The theme 'sphinx_rtd_theme' is no longer distributed with sphinx by default, only use when available. + fw(r""" +try: + __import__('sphinx_rtd_theme') + html_theme = 'sphinx_rtd_theme' +except ModuleNotFoundError: + pass +""") + + fw("if html_theme == 'sphinx_rtd_theme':\n") + fw(" html_theme_options = {\n") + fw(" 'canonical_url': 'https://docs.blender.org/api/current/',\n") + # fw(" 'analytics_id': '',\n") + # fw(" 'collapse_navigation': True,\n") + fw(" 'sticky_navigation': False,\n") + fw(" 'navigation_depth': 1,\n") + # fw(" 'includehidden': True,\n") + # fw(" 'titles_only': False\n") fw(" }\n\n") # not helpful since the source is generated, adds to upload size. |