Skip to contentSkip to conversation

doc: fix sphinx rtd theme import in GHA

PATCH Applied David Marchand 3 participants 3 messages Apr 1, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: fix sphinx rtd theme import in GHA

If the rtd theme is available, passing it by name is enough to select it. Sphinx itself recognises the "sphinx_rtd_theme" name as a special case and tries to find its path automatically.

On the other hand, passing a html_theme_path makes sphinx parse all themes availables in this path, which in some environment (like GHA) is /usr/share and makes sphinx error on the first zipfile it finds (in GHA, some Azure CLI thingy) that has no sphinx theme in it.

Fixes 46562be65094 ("doc: import sphinx rtd theme when available")
---
 doc/guides/conf.py | 1 -
 1 file changed, 1 deletion(-)
doc/guides/conf.py +0 -1
index aceeb62a4f..ec59aeae7e 100644
@@ -20,7 +20,6 @@
     import sphinx_rtd_theme
 
     html_theme = "sphinx_rtd_theme"
-    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
 except:
     print('Install the sphinx ReadTheDocs theme for improved html documentation '
           'layout: https://sphinx-rtd-theme.readthedocs.io/',
Signature · 1 line
2.23.0
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · David Marchand

If the rtd theme is available, passing it by name is enough to select it. Sphinx itself recognises the "sphinx_rtd_theme" name as a special case and tries to find its path automatically.

On the other hand, passing a html_theme_path makes sphinx parse all themes availables in this path, which in some environment (like GHA) is /usr/share and makes sphinx error on the first zipfile it finds (in GHA, some Azure CLI thingy) that has no sphinx theme in it.

Quoted 5 lines
Fixes 46562be65094 ("doc: import sphinx rtd theme when available")

---

https://github.com/ovsrobot/dpdk/tree/series_16066
https://github.com/ovsrobot/dpdk/actions/runs/709682570

Quoted 15 lines
 doc/guides/conf.py | 1 -
 1 file changed, 1 deletion(-)
doc/guides/conf.py +0 -1
index aceeb62a4f..ec59aeae7e 100644
@@ -20,7 +20,6 @@
     import sphinx_rtd_theme
 
     html_theme = "sphinx_rtd_theme"
-    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
 except:
     print('Install the sphinx ReadTheDocs theme for improved html documentation '
           'layout: https://sphinx-rtd-theme.readthedocs.io/',
#2 lore raw

01/04/2021 22:37, Aaron Conole:

Quoted 14 lines
Quoted 12 lines · David Marchand

If the rtd theme is available, passing it by name is enough to select it. Sphinx itself recognises the "sphinx_rtd_theme" name as a special case and tries to find its path automatically.

On the other hand, passing a html_theme_path makes sphinx parse all themes availables in this path, which in some environment (like GHA) is /usr/share and makes sphinx error on the first zipfile it finds (in GHA, some Azure CLI thingy) that has no sphinx theme in it.

Fixes 46562be65094 ("doc: import sphinx rtd theme when available")
Quoted 7 lines
Quoted 2 lines

---

https://github.com/ovsrobot/dpdk/tree/series_16066
https://github.com/ovsrobot/dpdk/actions/runs/709682570

Applied, thanks for the quick workaround.

This patch is removing html_theme_path,
not sure in which situation it was useful.
Future will tell.

From sphinx doc:
"
If the theme does not come with Sphinx, it can be in two static forms or as a Python package. For the static forms, either a directory (containing theme.conf and other needed files), or a zip file with the same contents is supported. The directory or zipfile must be put where Sphinx can find it; for this there is the config value html_theme_path. This can be a list of directories, relative to the directory containing conf.py, that can contain theme directories or zip files. "