Skip to contentSkip to conversation

docs: Only load the translations extension for HTML output

PATCH In review Jonathan Corbet 3 participants 6 messages Feb 14, 2024 – Feb 15, 2024 Documentation

lore
Share & tools
lore

Jonathan Corbet

author maintainer
#0 lore raw

PATCH 1/1 docs: Only load the translations extension for HTML output

This extension brings no value for other output formats and can create problems with the pdfdocs build.

---
 Documentation/conf.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Documentation/conf.py +7 -1
index 5830b01c5642..6071d3e24375 100644
@@ -55,7 +55,13 @@ needs_sphinx = '2.4.4'
 extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
               'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
               'maintainers_include', 'sphinx.ext.autosectionlabel',
-              'kernel_abi', 'kernel_feat', 'translations']
+              'kernel_abi', 'kernel_feat']
+#
+# Only enable the translation extension if we are building the HTML docs;
+# it brings no value otherwise and can cause problems.
+#
+if 'html' in sys.argv:
+    extensions.append('translations')
 
 if major >= 3:
     if (major > 3) or (minor > 0 or patch >= 2):
Signature · 1 line
2.43.0
#1 lore raw

Hi Jon,

Quoted 14 lines · Jonathan Corbet

This extension brings no value for other output formats and can create problems with the pdfdocs build.

---
 Documentation/conf.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Documentation/conf.py +0 -0
index 5830b01c5642..6071d3e24375 100644
@@ -55,7 +55,13 @@ needs_sphinx = '2.4.4'
 extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',

Documentation/conf.py needs_sphinx = '2.4.4' · line 64

Quoted 10 lines
Documentation/conf.py +7 -1
               'kfigure', 'sphinx.ext.ifconfig', 'automarkup',
               'maintainers_include', 'sphinx.ext.autosectionlabel',
-              'kernel_abi', 'kernel_feat', 'translations']
+              'kernel_abi', 'kernel_feat']
+#
+# Only enable the translation extension if we are building the HTML docs;
+# it brings no value otherwise and can cause problems.
+#
+if 'html' in sys.argv:
+    extensions.append('translations')

I tested incremental build of latexdocs against Sphinx 7.2.6 as follows:

make cleandocs
make htmldocs
make latexdocs

Without this change, "make latexdocs" completes 2 or 3 minutes quicker than full builds.

With this change applied and against Sphinx 7.2.6, "make latexdocs" slows down significantly (the same as the slowdown of incremental builds reported elsewhere), and it ends up in an exception, whose message reads:

--------------------------
WARNING: unknown node type: <LanguagesNode: <#text: 'Chinese (Simpl ...'><#text: 'Chinese (Tradi ... ...>

Exception occurred:
File "/home/akira/sphinx-7.2.6/lib/python3.10/site-packages/docutils/nodes.py", line 2068, in unknown_departure

    raise NotImplementedError(

NotImplementedError: <class 'sphinx.writers.latex.LaTeXTranslator'> departing unknown node type: LanguagesNode The full traceback has been saved in /tmp/sphinx-err-3inve171.log, if you want to report the issue to the developers.
--------------------------

I don't see the error against Sphinx 4.3.2 (of Ubuntu 22.04). So it is (again) dependent on Sphinx or docutils version.

For v6.8, how about loading translations extension with Sphinx<6.1.3 or Sphinx>=7.2 for all the builders.

Note that Linux distros to be released in a couple of month, Ubuntu 24.04 and Fedora 40 have Sphinx 7.2.6 in their pre-release repository. openSUSE Leap 15.5 already has 7.2.6 as a package of the name python311-Sphinx.

Thanks, Akira

Quoted 3 lines
Documentation/conf.py +0 -0
 if major >= 3:
     if (major > 3) or (minor > 0 or patch >= 2):
#2 lore raw
Quoted 9 lines · Akira Yokosawa

Documentation/conf.py needs_sphinx = '2.4.4' · line 64

Quoted 6 lines · Jonathan Corbet
Documentation/conf.py +6 -0
+#
+# Only enable the translation extension if we are building the HTML docs;
+# it brings no value otherwise and can cause problems.
+#
+if 'html' in sys.argv:
+    extensions.append('translations')

I tested incremental build of latexdocs against Sphinx 7.2.6 as follows:

[...]

Quoted 7 lines

WARNING: unknown node type: <LanguagesNode: <#text: 'Chinese (Simpl ...'><#text: 'Chinese (Tradi ... ...>

Exception occurred:

   File "/home/akira/sphinx-7.2.6/lib/python3.10/site-packages/docutils/nodes.py", line 2068, in unknown_departure
     raise NotImplementedError(

NotImplementedError: <class 'sphinx.writers.latex.LaTeXTranslator'> departing unknown node type: LanguagesNode The full traceback has been saved in /tmp/sphinx-err-3inve171.log, if you want to report the issue to the developers.

Jon, this is pretty much what I said would happen here:

https://lore.kernel.org/all/[email protected]/

I have a proper fix that should fix all errors everywhere:

https://lore.kernel.org/all/[email protected]/

Why not use that? I'll do a proper submission, I was just waiting a couple of days to see if anybody else would would test it too.

Vegard

#3 lore raw

Hi Vegard,

Quoted 22 lines · Vegard Nossum
Quoted 9 lines · Akira Yokosawa

Documentation/conf.py needs_sphinx = '2.4.4' · line 64

Quoted 6 lines · Jonathan Corbet
Documentation/conf.py +6 -0
+#
+# Only enable the translation extension if we are building the HTML docs;
+# it brings no value otherwise and can cause problems.
+#
+if 'html' in sys.argv:
+    extensions.append('translations')

I tested incremental build of latexdocs against Sphinx 7.2.6 as follows:

[...]

Quoted 7 lines

WARNING: unknown node type: <LanguagesNode: <#text: 'Chinese (Simpl ...'><#text: 'Chinese (Tradi ... ...>

Exception occurred:
   File "/home/akira/sphinx-7.2.6/lib/python3.10/site-packages/docutils/nodes.py", line 2068, in unknown_departure raise NotImplementedError(
NotImplementedError: <class 'sphinx.writers.latex.LaTeXTranslator'> departing unknown node type: LanguagesNode The full traceback has been saved in /tmp/sphinx-err-3inve171.log, if you want to report the issue to the developers.

Quoted 7 lines

Jon, this is pretty much what I said would happen here:

https://lore.kernel.org/all/[email protected]/

I have a proper fix that should fix all errors everywhere:

https://lore.kernel.org/all/[email protected]/

Oh, that's even better!

Quoted 3 lines

Why not use that? I'll do a proper submission, I was just waiting a couple of days to see if anybody else would would test it too.

I didn't respond because I mistook your words

Quoted 1 line

I'll test a bit more and submit a proper patch if this works.

and decided to wait for a proper patch from you. I was thinking the delay meant there was something you needed to work further...

I've just tested your proper patch and it worked across v4.3.2 (of Ubuntu 22.04) and V6.2.1 (of Fedora 39), among others.

Many thanks,
Akira

Quoted 3 lines

Vegard

#4 lore raw
Quoted 9 lines · Akira Yokosawa
Quoted 7 lines · Vegard Nossum

Jon, this is pretty much what I said would happen here:

https://lore.kernel.org/all/[email protected]/

I have a proper fix that should fix all errors everywhere:

https://lore.kernel.org/all/[email protected]/

Quoted 7 lines

Oh, that's even better!

Quoted 3 lines

Why not use that? I'll do a proper submission, I was just waiting a couple of days to see if anybody else would would test it too.

I didn't respond because I mistook your words

Rereading my email I see that it is ambiguous, sorry for the confusion.

Quoted 7 lines
Quoted 1 line

I'll test a bit more and submit a proper patch if this works.

and decided to wait for a proper patch from you. I was thinking the delay meant there was something you needed to work further...

I've just tested your proper patch and it worked across v4.3.2 (of Ubuntu 22.04) and V6.2.1 (of Fedora 39), among others.

Thank you!

Vegard

author maintainer
#5 lore raw
In reply to Akira Yokosawa
Quoted 6 lines · Akira Yokosawa

I tested incremental build of latexdocs against Sphinx 7.2.6 as follows:

make cleandocs
make htmldocs
make latexdocs

Quoted 7 lines

Without this change, "make latexdocs" completes 2 or 3 minutes quicker than full builds.

With this change applied and against Sphinx 7.2.6, "make latexdocs" slows down significantly (the same as the slowdown of incremental builds reported elsewhere), and it ends up in an exception, whose message reads:

That, I must confess, mystifies me completely, the slowdown especially.

Oh well, I'll drop this and look at Vegard's patch.

Thanks,

jon