From c24dd0c244924ab8ff5099156939c6f54a7f4b2a Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Mon, 18 Sep 2023 14:20:56 +0200 Subject: [PATCH] Move sphinx_rtd_theme to the readthedocs requirements This package was removed from the OpenStack requirements with [1] so keeping it in the doc/requirements.txt file is causing failure in the requirements-check job. As we want to use this theme to build our docs, lets keep it in the readthedocs_requirements.txt file which isn't checked by the requirements-check job at all. This patch also changes docs and releasenotes configs in the way that it will fallback to one of the default themes provided by sphinx. Finally it makes some additional changes to the releasenotes conf.py file to make build of the releasenotes working fine. [1] https://review.opendev.org/c/openstack/requirements/+/893665 Change-Id: Iff03b8596a9e772940fd959efa7cbf80a68e9eab --- doc/readthedocs_requirements.txt | 1 + doc/requirements.txt | 1 - doc/source/conf.py | 6 ++++- releasenotes/source/conf.py | 41 +++++++++++++++++--------------- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/doc/readthedocs_requirements.txt b/doc/readthedocs_requirements.txt index d93014710..ca4b4e69b 100644 --- a/doc/readthedocs_requirements.txt +++ b/doc/readthedocs_requirements.txt @@ -6,3 +6,4 @@ -r ../test-requirements.txt -r ../extra-requirements.txt -r ./requirements.txt +sphinx_rtd_theme>=0.5.1 # MIT diff --git a/doc/requirements.txt b/doc/requirements.txt index 3dee1be8a..70f78ad10 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -4,4 +4,3 @@ reno>=3.2.0 # Apache-2.0 sphinx>=3.4.2 # BSD -sphinx_rtd_theme>=0.5.1 # MIT diff --git a/doc/source/conf.py b/doc/source/conf.py index ef695d13a..58134afa0 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -97,7 +97,11 @@ todo_include_todos = True # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = "sphinx_rtd_theme" +try: + import sphinx_rtd_theme + html_theme = "sphinx_rtd_theme" +except ModuleNotFoundError: + html_theme = 'alabaster' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 2d1dd5c7c..8610bd927 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -81,7 +81,7 @@ master_doc = 'index' # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -97,25 +97,28 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = "sphinx_rtd_theme" +try: + import sphinx_rtd_theme + html_theme = "sphinx_rtd_theme" + # Theme options are theme-specific and customize the look and feel of a + # theme further. For a list of options available for each theme, see the + # documentation. + html_theme_options = { + "logo_only": False, + "display_version": True, + "prev_next_buttons_location": "top", + "style_external_links": True, + # Toc options + "collapse_navigation": True, + "sticky_navigation": True, + "navigation_depth": 4, + "includehidden": True, + "titles_only": False, + } +except ModuleNotFoundError: + html_theme = 'alabaster' + html_theme_options = {} -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -html_theme_options = { - "canonical_url": "https://docs.openstack.org/tobiko/latest/", - "logo_only": False, - "display_version": True, - "prev_next_buttons_location": "top", - "style_external_links": True, - # Toc options - "collapse_navigation": True, - "sticky_navigation": True, - "navigation_depth": 4, - "includehidden": True, - "titles_only": False, -} # Add any paths that contain custom static files (such as style sheets) here,