doc: fix sphinx rtd theme import in GHA

Message ID 20210401195842.13044-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series doc: fix sphinx rtd theme import in GHA |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/travis-robot success travis build: passed
ci/github-robot success github build: passed

Commit Message

David Marchand April 1, 2021, 7:58 p.m. UTC
  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")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/conf.py | 1 -
 1 file changed, 1 deletion(-)
  

Comments

Aaron Conole April 1, 2021, 8:37 p.m. UTC | #1
David Marchand <david.marchand@redhat.com> writes:

> 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")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

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

Acked-by: Aaron Conole <aconole@redhat.com>

>  doc/guides/conf.py | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/doc/guides/conf.py b/doc/guides/conf.py
> index aceeb62a4f..ec59aeae7e 100644
> --- a/doc/guides/conf.py
> +++ b/doc/guides/conf.py
> @@ -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/',
  
Thomas Monjalon April 1, 2021, 11:59 p.m. UTC | #2
01/04/2021 22:37, Aaron Conole:
> David Marchand <david.marchand@redhat.com> writes:
> 
> > 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")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> 
> https://github.com/ovsrobot/dpdk/tree/series_16066
> https://github.com/ovsrobot/dpdk/actions/runs/709682570
> 
> Acked-by: Aaron Conole <aconole@redhat.com>

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.
"
  

Patch

diff --git a/doc/guides/conf.py b/doc/guides/conf.py
index aceeb62a4f..ec59aeae7e 100644
--- a/doc/guides/conf.py
+++ b/doc/guides/conf.py
@@ -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/',