Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sphinx to 4.5.0 and sphinx_rtd_theme to 1.0.0 #29

Merged

Conversation

rschwebel
Copy link
Contributor

In flamingo-1.7.1, the sphinx theme is broken, see for example #28. Update the components to the latest releases.

This is not ready for python3.10 yet, but a prerequisite to fix further issues.

@rschwebel
Copy link
Contributor Author

Fix overlong line.

@codecov
Copy link

codecov bot commented May 6, 2022

Codecov Report

Merging #29 (4725f2e) into master (4eddb85) will decrease coverage by 0.00%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##           master      #29      +/-   ##
==========================================
- Coverage   51.28%   51.28%   -0.01%     
==========================================
  Files          66       66              
  Lines        4071     4077       +6     
  Branches      885      886       +1     
==========================================
+ Hits         2088     2091       +3     
- Misses       1778     1781       +3     
  Partials      205      205              
Impacted Files Coverage Δ
flamingo/plugins/sphinx_themes/sphinx_theme.py 22.29% <14.28%> (+0.07%) ⬆️
flamingo/plugins/sphinx_themes/defaults.py 95.83% <100.00%> (+0.18%) ⬆️
flamingo/plugins/sphinx_themes/plugin.py 20.71% <100.00%> (+0.47%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4eddb85...4725f2e. Read the comment docs.

setup.py Outdated Show resolved Hide resolved
Until now we hold sphinx_rtd_theme at version 0.5.2, as the flamingo
integration was not compatible with newer versions.

In order to update to sphinx_rtd_theme 1.0.0, we have to add a registry
to the SphinxApp, as the HTMLThemeFactory expects to search for themes
in app.registry.html_themes now.

Update sphinx to 4.5.0, which is currently the latest and greatest.

While being there, we change the version pinning to a ">=" and try to
break & fix fast in the future.

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Newer versions of the sphinx_rtd_theme (tested with 1.0.0) expect that
sphinx_version is set to a string containing 'x.y.z' with x=major,
y=minor, z=micro version.

Without this patch, rendering the theme explodes with:

ValueError: not enough values to unpack (expected 3, got 1)
/tmp/tmp8chn8nwv/sphinx-themes/theme/templates/layout.html:13

10{%- set sphinx_writer = 'writer-html5' if html5_doctype else 'writer-html4' -%}
11
12{# Build sphinx_version_info tuple from sphinx_version string in pure Jinja #}
13{%- set (_ver_major, _ver_minor, _ver_bugfix) = sphinx_version.split('.') | map('int') -%}
14{%- set sphinx_version_info = (_ver_major, _ver_minor, _ver_bugfix) -%}
15
16<!DOCTYPE html>

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Newer versions of the sphinx_rtd_theme (tested with 1.0.0) expect the
logo to be specified in the logo_url context variable. Provide it as a
default, in order to make it overwritable in the projects' settings.py.

Note that, in contrast to Sphinx, flamingo doesn't automatically set the
'logo' context variable, so you must provide SPHINX_THEMES_LOGO=True in
order to show the logo at all.

Example, from a project's settings.py:

  # workaround: if 'logo' isn't defined, the sphinx_rtd_theme doesn't
  # render the logo at all; if we set it to something defined, 'logo_url'
  # below is actually used
  SPHINX_THEMES_LOGO = True
  SPHINX_THEMES_LOGO_URL = '/static/mylogo.svg'

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
@rschwebel rschwebel force-pushed the rsc/issue-28-sphinx_rtd_theme_update branch from 1eb548f to 4725f2e Compare May 9, 2022 08:13
@rschwebel
Copy link
Contributor Author

Ok, I have changed to >= and adapted the commit message.

@rschwebel rschwebel merged commit ab9a0e0 into pengutronix:master May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants