Skip to content

Commit

Permalink
fix building docs on Debian Bullseye (ganeti#1602)
Browse files Browse the repository at this point in the history
When building docs with man pages (`--enable-manpages-in-doc`) the
following issues exists:

* Sphinx refdomain=None no longer works. In a previous fix (commit
  388c0b6) refdomain=None was
  introduced. However this emits a deprecation warning on pre Debian
  Bullseye (i.e. Ubuntu Focal) and no longer works on Bullseye. Fix this
  by setting refdomain=std:

  RemovedInSphinx20Warning: Invalid pendig_xref node detected. :doc: reference should have refdomain=std attribute.

* On Bullseye an other deprecation warning is emitted and no longer
  works the old way. Fixing this as suggested in the warning, while keeping
  support for sphinx before 2.1.0:

  RemovedInSphinx40Warning: app.add_lexer() API changed; Please give lexer class instead of instance

Signed-off-by: Sascha Lucas <sascha_lucas@web.de>
  • Loading branch information
saschalucas committed Oct 13, 2021
1 parent e841777 commit 40c4390
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/build/shell_example_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

from pygments.lexer import RegexLexer, bygroups, include
from pygments.token import Name, Text, Generic, Comment
import sphinx


class ShellExampleLexer(RegexLexer):
Expand Down Expand Up @@ -79,4 +80,8 @@ class ShellExampleLexer(RegexLexer):


def setup(app):
app.add_lexer("shell-example", ShellExampleLexer())
version = tuple(map(int, sphinx.__version__.split('.')))
if version >= (2, 1, 0):
app.add_lexer("shell-example", ShellExampleLexer)
else:
app.add_lexer("shell-example", ShellExampleLexer())
2 changes: 1 addition & 1 deletion lib/build/sphinx_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def _ManPageNodeClass(*args, **kwargs):

# Force custom title
kwargs["refexplicit"] = True
kwargs["refdomain"] = None
kwargs["refdomain"] = "std"

return sphinx.addnodes.pending_xref(*args, **kwargs)

Expand Down

0 comments on commit 40c4390

Please sign in to comment.