Hi On Thu, May 13, 2021 at 9:17 PM Peter Maydell wrote: > On Thu, 13 May 2021 at 17:03, Marc-André Lureau > wrote: > > This should work, can you check?: > > > > diff --git a/docs/conf.py b/docs/conf.py > > index 3802b70d62..9e3d7cee0e 100644 > > --- a/docs/conf.py > > +++ b/docs/conf.py > > @@ -29,6 +29,7 @@ > > import os > > import sys > > import sphinx > > +from packaging.version import parse as parse_version > > from sphinx.errors import ConfigError > > > > # Make Sphinx fail cleanly if using an old Python, rather than obscurely > > @@ -162,7 +163,7 @@ > > # 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. > > -if html_theme == 'sphinx_rtd_theme': > > +if parse_version(sphinx_rtd_theme.__version__) >= > parse_version('0.4.3'): > > html_theme_options = { > > "style_nav_header_background": "#802400", > > } > > This fails: > > ../../docs/meson.build:30: WARNING: /usr/bin/sphinx-build: > Configuration error: > There is a programable error in your configuration file: > > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/sphinx/config.py", line 157, in > __init__ > execfile_(filename, config) > File "/usr/lib/python3/dist-packages/sphinx/util/pycompat.py", line > 150, in execfile_ > exec_(code, _globals) > File "conf.py", line 32, in > from packaging.version import parse as parse_version > ModuleNotFoundError: No module named 'packaging' > > > According to SO ( https://stackoverflow.com/questions/11887762/how-do-i-compare-version-numbers-in-python) there is a second built-in option to compare versions. diff --git a/docs/conf.py b/docs/conf.py index 3802b70d62..00cf66ab54 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,6 +29,7 @@ import os import sys import sphinx +from distutils.version import LooseVersion from sphinx.errors import ConfigError # Make Sphinx fail cleanly if using an old Python, rather than obscurely @@ -162,7 +163,7 @@ # 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. -if html_theme == 'sphinx_rtd_theme': +if LooseVersion(sphinx_rtd_theme.__version__) >= LooseVersion("0.4.3"): html_theme_options = { "style_nav_header_background": "#802400", } Let me know if you want a new PR. > > > However, we agreed before to not have support fallbacks for missing > deps. Perhaps we should require rtd >= 0.4.3 instead? > > That would prevent the docs from building on too many platforms, > I think. 0.4.3 was only released upstream in Feb 2019. > > Ok -- Marc-André Lureau