Skip to contentSkip to conversation

fix epub and latexpdf targets not finding glob images

RFC PATCH Superseded Quentin Schulz 3 participants 7 messages Oct 30, 2025 – Nov 7, 2025

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover fix epub and latexpdf targets not finding glob images

Currently the make all target simply doesn't work, it'll fail the epub build because of missing images (the ones listed in image or figure directives with glob patterns).

The same can be reproduced with make html epub or make html latexpdf. This is due to how Sphinx caches the output of the parsing step and the way we generate the PDFs and PNGs from SVGs for the epub and latexpdf targets (which are run after the html target).

This migrates us from this Makefile logic to sphinxcontrib-svg2pdfconverter, or rather an in-tree fork of it.

Marked as RFC because
1) The source code of the plugin is licensed under BSD-3-Clause and IANAL so I don't know if it's fine for us,
2) I would rather use upstream and add sphinxcontrib-svg2pdfconverter to Pipfile and the docs building instructions, but we need the MR[1] to be merged and a new release made before we can do that. Once upstream merges it, we likely will need to add a recipe for it in OE-Core to be able to still build the docs with the docs toolchain I believe?

See the last patch in the series for a description of the actual problem, a dive-in Sphinx cache and why I believe this is the proper fix.

[1] https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter/pull/31

---
Quentin Schulz (3):
sphinx: import sphinxcontrib.rsvgconverter sphinx plugin in-tree
sphinx: rsvgconverter: add support for PNG output convert SVGs to PDF and PNG using rsvgconverter plugin

 documentation/Makefile                |  26 +--------
 documentation/conf.py                 |   5 ++
 documentation/sphinx/rsvgconverter.py | 106 ++++++++++++++++++++++++++++++++++
 3 files changed, 114 insertions(+), 23 deletions(-)

---
base-commit: 8b85245490ae0b19a9c3880ec31e55b42e19d094
change-id: 20251029-fix-make-multi-target-d2de9d4ff7ec

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>
#1 lore raw

RFC PATCH 1/3 sphinx: import sphinxcontrib.rsvgconverter sphinx plugin in-tree

From: Quentin Schulz <[email protected]>

Imported from https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter/blob/5add946275c06d2b338f64d169bc087ef99ebac3/sphinxcontrib/rsvgconverter.py

It'll be modified in the next commit to add support for SVG-PNG conversion.

---
 documentation/sphinx/rsvgconverter.py | 96 +++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
documentation/sphinx/rsvgconverter.py new file +96 -0
new file mode 100644
index 000000000..5ae858029
@@ -0,0 +1,96 @@
+# -*- coding: utf-8 -*-
+"""
+    sphinxcontrib.rsvgconverter
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    Converts SVG images to PDF using libRSVG in case the builder does not
+    support SVG images natively (e.g. LaTeX).
+
+    :copyright: Copyright 2018-2023 by Stefan Wiehler
+                <[email protected]>.
+    :license: BSD, see LICENSE.txt for details.
+"""
+import subprocess
+
+from sphinx.errors import ExtensionError
+from sphinx.locale import __
+from sphinx.transforms.post_transforms.images import ImageConverter
+from sphinx.util import logging
+from errno import ENOENT, EPIPE, EINVAL
+
+if False:
+    # For type annotation
+    from typing import Any, Dict  # NOQA
+    from sphinx.application import Sphinx  # NOQA
+
+
+logger = logging.getLogger(__name__)
+
+
+class RSVGConverter(ImageConverter):
+    conversion_rules = [
+        ('image/svg+xml', 'application/pdf'),
+    ]
+
+    def is_available(self):
+        # type: () -> bool
+        """Confirms if RSVG converter is available or not."""
+        try:
+            args = [self.config.rsvg_converter_bin, '--version']
+            logger.debug('Invoking %r ...', args)
+            ret = subprocess.call(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+            if ret == 0:
+                return True
+            else:
+                return False
+        except (OSError, IOError):
+            logger.warning(__('RSVG converter command %r cannot be run. '
+                              'Check the rsvg_converter_bin setting'),
+                           self.config.rsvg_converter_bin)
+            return False
+
+    def convert(self, _from, _to):
+        # type: (unicode, unicode) -> bool
+        """Converts the image from SVG to PDF via libRSVG."""
+        try:
+            args = ([self.config.rsvg_converter_bin] +
+                    self.config.rsvg_converter_args +
+                    ['--format=' + self.config.rsvg_converter_format,
+                     '--output=' + str(_to), str(_from)])
+            logger.debug('Invoking %r ...', args)
+            p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+        except OSError as err:
+            if err.errno != ENOENT:  # No such file or directory
+                raise
+            logger.warning(__('RSVG converter command %r cannot be run. '
+                              'Check the rsvg_converter_bin setting'),
+                           self.config.rsvg_converter_bin)
+            return False
+
+        try:
+            stdout, stderr = p.communicate()
+        except (OSError, IOError) as err:
+            if err.errno not in (EPIPE, EINVAL):
+                raise
+            stdout, stderr = p.stdout.read(), p.stderr.read()
+            p.wait()
+        if p.returncode != 0:
+            raise ExtensionError(__('RSVG converter exited with error:\n'
+                                    '[stderr]\n%s\n[stdout]\n%s') %
+                                 (stderr, stdout))
+
+        return True
+
+
+def setup(app):
+    # type: (Sphinx) -> Dict[unicode, Any]
+    app.add_post_transform(RSVGConverter)
+    app.add_config_value('rsvg_converter_bin', 'rsvg-convert', 'env')
+    app.add_config_value('rsvg_converter_args', [], 'env')
+    app.add_config_value('rsvg_converter_format', 'pdf', 'env')
+
+    return {
+        'version': 'builtin',
+        'parallel_read_safe': True,
+        'parallel_write_safe': True,
+    }
Signature · 1 line
2.51.0
#2 lore raw

RFC PATCH 2/3 sphinx: rsvgconverter: add support for PNG output

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

All tools used currently for converting from SVG to PDF actually also support converting to PNG, so let's add support for that.

Note that I didn't check on Inkscape < 1.0 so I simply adapted the code to what I believe should be correct. At the same time, I'm not sure there are many distros still using Inkscape < 1.0 nowadays so hopefully that should be pretty safe.

[imported from https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter/pull/31/commits/bfd73e78a8be788951bd12d81f4270d67f9efeba]
[removed from the diff anything not rsvgconverter.py]
---
 documentation/sphinx/rsvgconverter.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
documentation/sphinx/rsvgconverter.py +13 -3
index 5ae858029..a63f180a1 100644
@@ -3,13 +3,14 @@
     sphinxcontrib.rsvgconverter
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-    Converts SVG images to PDF using libRSVG in case the builder does not
+    Converts SVG images to PDF or PNG using libRSVG in case the builder does not
     support SVG images natively (e.g. LaTeX).
 
     :copyright: Copyright 2018-2023 by Stefan Wiehler
                 <[email protected]>.
     :license: BSD, see LICENSE.txt for details.
 """
+import pathlib
 import subprocess
 
 from sphinx.errors import ExtensionError
@@ -30,6 +31,7 @@ logger = logging.getLogger(__name__)
 class RSVGConverter(ImageConverter):
     conversion_rules = [
         ('image/svg+xml', 'application/pdf'),
+        ('image/svg+xml', 'image/png'),
     ]
 
     def is_available(self):
@@ -51,11 +53,17 @@ class RSVGConverter(ImageConverter):
 
     def convert(self, _from, _to):
         # type: (unicode, unicode) -> bool
-        """Converts the image from SVG to PDF via libRSVG."""
+        """Converts the image from SVG to PDF or PNG via libRSVG."""
         try:
+            # Guess output format based on file extension
+            fmt = pathlib.Path(str(_to)).suffix[1:]
+            # rsvg-convert supports different standards of PDF, so use the
+            # rsvg_converter_format config when building a PDF
+            if fmt == 'pdf':
+                fmt = self.config.rsvg_converter_format
             args = ([self.config.rsvg_converter_bin] +
                     self.config.rsvg_converter_args +
-                    ['--format=' + self.config.rsvg_converter_format,
+                    ['--format=' + fmt,
                      '--output=' + str(_to), str(_from)])
             logger.debug('Invoking %r ...', args)
             p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
@@ -86,7 +94,9 @@ def setup(app):
     # type: (Sphinx) -> Dict[unicode, Any]
     app.add_post_transform(RSVGConverter)
     app.add_config_value('rsvg_converter_bin', 'rsvg-convert', 'env')
+    # Applies to both PDF and PNG output
     app.add_config_value('rsvg_converter_args', [], 'env')
+    # Only applies to PDF output
     app.add_config_value('rsvg_converter_format', 'pdf', 'env')
 
     return {
Signature · 1 line
2.51.0
#3 lore raw

RFC PATCH 3/3 convert SVGs to PDF and PNG using rsvgconverter plugin

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

The rsvgconverter plugin allows to generate a PDF or PNG from an SVG. This is what we already do manually via Make targets but it isn't good enough.

Sphinx generates a cache upon first parsing and stores it in a doctrees directory. Sphinx claims that it can be shared between all builders[1]. For glob patterns in image or figure directives, Sphinx will look for all possible matches in the source tree and store those in a "candidates" map for each file, along with the associated mimetype. When building, Sphinx will then look in this map to try to find a match in the current builder's supported_image_types. If none is found, the build will fail.

The latexpdf (using the LaTeXBuilder) target does not support SVGs by default[2]. We used Make to generate PDFs from them before generating the doc PDF though (see PDFs variable and %.pdf in Makefile) and that type is supported by default[2].

The epub (via the Epub3Builder) target does support SVGs by default[3] but we disabled their support in commit ff3876ca4910 ("conf.py: use PNG first in EPUB output"). We used Make to generate PNGs from them before generating the doc epub though (see PNGs variable and %.png in Makefile) and that type is supported (c.f. Epub3Builder.supported_image_types in our conf.py).

The issue is that this is done transparently from Sphinx. When we generate the PDFs or PNGs variants of the SVGs, we put them in-tree directly along their source file. Then, when caching, Sphinx will find both the source file and the appropriate variant. However, the cache isn't updated if there are new files in the tree and the source rST files aren't modified. So, the cache will not have its map updated and we won't be able to find the new variant when building for a non-SVG-compatible builder. Take the following scenario:

- start from a clean source file (fresh clone or git clean -ffdx)
- build the html target (which supports SVGs by default[4])
- sphinx will find all the files in the source tree matching the glob pattern in ".. image:: test.*", in our case only an SVG since the PDFs and PNGs are only generated for the latexpdf and epub targets respectively. The cache will only store the path to the SVG file because it is the only source file that matches the glob,
- attempt to build the epub target (which doesn't support SVGs, only PNGs)
- Sphinx checks for the file to include for '.. image:: test.*' and finds an SVG in the cache map and then check the list of supported image types for the Epub3Builder and find that it doesn't support that. It cannot find anything satisfying the dependency and thus fails to build.

This scenario can easily be reproduced by running the make all command since the html builder will be used first, then epub and finally latexpdf.

The make publish target works by chance, because the epub builder is built first and will cache SVG + PNG for each glob, then the latexpdf builder is built and supports PNGs so that's fine and then html, which supports SVG as well.

To fix this issue, we could simply always generate PDFs and PNGs of all SVGs in the source tree, but this isn't ideal.

Instead, let's use an ImageConverter from a Sphinx plugin. This allows to map a plugin as being able to generate a file of type Y from a file of type X. When Sphinx wants to build an image, it'll try to find the image with the type the current builder supports in the cache. If it cannot, it's going to try to find an ImageConverter plugin that is able to convert one of the image types in cache with one of the image types the current builder supports. Then Sphinx will call this plugin to generate the file and put it into the build directory (not in the source!).

This allows to simplify the Makefile as well and is a much cleaner approach.

The epub target is removed as the catch-all target contains the same instructions as the epub target we remove in this commit.

Ideally, we shouldn't use our in-tree fork but the upstream project sphinxcontrib.rsvgconverter, though it currently only supports generating PDFs from SVGs and we also need PNGs. A merge request to add support for this is pending[5].

[1] https://www.sphinx-doc.org/en/master/man/sphinx-build.html#cmdoption-sphinx-build-d
[2] https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.latex.LaTeXBuilder.supported_image_types
[3] https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.epub3.Epub3Builder.supported_image_types
[4] https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.html.StandaloneHTMLBuilder
[5] https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter/pull/31

---
 documentation/Makefile | 26 +++-----------------------
 documentation/conf.py  |  5 +++++
 2 files changed, 8 insertions(+), 23 deletions(-)
documentation/Makefile +3 -23
index bade78fe8..2d6baed65 100644
@@ -13,8 +13,6 @@ SPHINXLINTDOCS ?= $(SOURCEDIR)
 IMAGEDIRS      = */svg
 BUILDDIR       = _build
 DESTDIR        = final
-SVG2PNG        = rsvg-convert
-SVG2PDF        = rsvg-convert
 
 ifeq ($(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi),0)
 $(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed")
@@ -24,7 +22,7 @@ endif
 help:
 	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
 
-.PHONY: all checks help Makefile clean stylecheck publish epub latexpdf
+.PHONY: all checks help Makefile clean stylecheck publish latexpdf
 
 publish: Makefile checks epub latexpdf html singlehtml
 	rm -rf $(BUILDDIR)/$(DESTDIR)/
@@ -35,22 +33,8 @@ publish: Makefile checks epub latexpdf html singlehtml
 	cp $(BUILDDIR)/singlehtml/index.html $(BUILDDIR)/$(DESTDIR)/singleindex.html
 	sed -i -e '[email protected]#@singleindex.html#@g' $(BUILDDIR)/$(DESTDIR)/singleindex.html
 
-# Build a list of SVG files to convert to PDFs
-PDFs := $(foreach dir, $(IMAGEDIRS), $(patsubst %.svg,%.pdf,$(wildcard $(SOURCEDIR)/$(dir)/*.svg)))
-
-# Build a list of SVG files to convert to PNGs
-PNGs := $(foreach dir, $(IMAGEDIRS), $(patsubst %.svg,%.png,$(wildcard $(SOURCEDIR)/$(dir)/*.svg)))
-
-# Pattern rule for converting SVG to PDF
-%.pdf : %.svg
-	$(SVG2PDF) --format=Pdf --output=$@ $<
-
-# Pattern rule for converting SVG to PNG
-%.png : %.svg
-	$(SVG2PNG) --format=Png --output=$@ $<
-
 clean:
-	@rm -rf $(BUILDDIR) $(PNGs) $(PDFs) poky.yaml sphinx-static/switchers.js releases.rst
+	@rm -rf $(BUILDDIR) poky.yaml sphinx-static/switchers.js releases.rst
 
 checks:
 	$(SOURCEDIR)/tools/check-glossaries --docs-dir $(SOURCEDIR)
@@ -62,14 +46,10 @@ stylecheck:
 sphinx-lint:
 	sphinx-lint $(SPHINXLINTDOCS)
 
-epub: $(PNGs)
-	$(SOURCEDIR)/set_versions.py
-	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
-
 # Note: we need to pass buf_size here (which is also configurable from
 # texmf.cnf), to avoid following error:
 #   Unable to read an entire line---bufsize=200000. Please increase buf_size in texmf.cnf.
-latexpdf: $(PDFs)
+latexpdf:
 	$(SOURCEDIR)/set_versions.py
 	buf_size=10000000 $(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
 
documentation/conf.py +5 -0
index c07b6c419..64dd911ff 100644
@@ -66,6 +66,11 @@ extensions = [
     'sphinx.ext.autosectionlabel',
     'sphinx.ext.extlinks',
     'sphinx.ext.intersphinx',
+    # our fork! Do not confuse for sphinxcontrib.rsvgconverter!
+    # FIXME: migrate to upstream once
+    # https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter/pull/31
+    # is merged
+    'rsvgconverter',
     'yocto-vars'
 ]
 autosectionlabel_prefix_document = True
Signature · 1 line
2.51.0
#4 lore raw

Re: [docs] [PATCH RFC 3/3] convert SVGs to PDF and PNG using rsvgconverter plugin

Hi,

Quoted 73 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

The rsvgconverter plugin allows to generate a PDF or PNG from an SVG. This is what we already do manually via Make targets but it isn't good enough.

Sphinx generates a cache upon first parsing and stores it in a doctrees directory. Sphinx claims that it can be shared between all builders[1]. For glob patterns in image or figure directives, Sphinx will look for all possible matches in the source tree and store those in a "candidates" map for each file, along with the associated mimetype. When building, Sphinx will then look in this map to try to find a match in the current builder's supported_image_types. If none is found, the build will fail.

The latexpdf (using the LaTeXBuilder) target does not support SVGs by default[2]. We used Make to generate PDFs from them before generating the doc PDF though (see PDFs variable and %.pdf in Makefile) and that type is supported by default[2].

The epub (via the Epub3Builder) target does support SVGs by default[3] but we disabled their support in commit ff3876ca4910 ("conf.py: use PNG first in EPUB output"). We used Make to generate PNGs from them before generating the doc epub though (see PNGs variable and %.png in Makefile) and that type is supported (c.f. Epub3Builder.supported_image_types in our conf.py).

The issue is that this is done transparently from Sphinx. When we generate the PDFs or PNGs variants of the SVGs, we put them in-tree directly along their source file. Then, when caching, Sphinx will find both the source file and the appropriate variant. However, the cache isn't updated if there are new files in the tree and the source rST files aren't modified. So, the cache will not have its map updated and we won't be able to find the new variant when building for a non-SVG-compatible builder. Take the following scenario:

- start from a clean source file (fresh clone or git clean -ffdx)
- build the html target (which supports SVGs by default[4])
- sphinx will find all the files in the source tree matching the glob pattern in ".. image:: test.*", in our case only an SVG since the PDFs and PNGs are only generated for the latexpdf and epub targets respectively. The cache will only store the path to the SVG file because it is the only source file that matches the glob,
- attempt to build the epub target (which doesn't support SVGs, only PNGs)
- Sphinx checks for the file to include for '.. image:: test.*' and finds an SVG in the cache map and then check the list of supported image types for the Epub3Builder and find that it doesn't support that. It cannot find anything satisfying the dependency and thus fails to build.

This scenario can easily be reproduced by running the make all command since the html builder will be used first, then epub and finally latexpdf.

The make publish target works by chance, because the epub builder is built first and will cache SVG + PNG for each glob, then the latexpdf builder is built and supports PNGs so that's fine and then html, which supports SVG as well.

To fix this issue, we could simply always generate PDFs and PNGs of all SVGs in the source tree, but this isn't ideal.

Instead, let's use an ImageConverter from a Sphinx plugin. This allows to map a plugin as being able to generate a file of type Y from a file of type X. When Sphinx wants to build an image, it'll try to find the image with the type the current builder supports in the cache. If it cannot, it's going to try to find an ImageConverter plugin that is able to convert one of the image types in cache with one of the image types the current builder supports. Then Sphinx will call this plugin to generate the file and put it into the build directory (not in the source!).

Quoted 5 lines

This allows to simplify the Makefile as well and is a much cleaner approach.

The epub target is removed as the catch-all target contains the same instructions as the epub target we remove in this commit.

So with your patch will the epub target include SVGs or PNGs? Apparently there were issues rendering SVGs in EPUBs as per Michael's commit:

conf.py: use PNG first in EPUB output

SVG directly included in EPUB output has multiple issues, in particular font size and alignment ones (tested on two EPUB readers). Instead, using PNG, generated from SVG when available as the primary format for images. GIF and JPEG are fine too.

Quoted 4 lines

Ideally, we shouldn't use our in-tree fork but the upstream project sphinxcontrib.rsvgconverter, though it currently only supports generating PDFs from SVGs and we also need PNGs. A merge request to add support for this is pending[5].

Are you willing to send a patch to OE-Core to add a recipe for it?

Otherwise: I'm all for using this instead of our Makefile rules, this is much cleaner.

But I can't say whether BSD / IANAL is fine to include in out repo though. I'd rather have a recipe for it if possible! (possibly with your patch on top, if it doesn't get applied?)

Thanks!
Antonin

Signature · 3 lines
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

Re: [docs] [PATCH RFC 3/3] convert SVGs to PDF and PNG using rsvgconverter plugin

Hi Antonin,

Quoted 3 lines · Antonin Godard

Hi,

On Thu Oct 30, 2025 at 4:17 PM CET, Quentin Schulz wrote:

[...]

Quoted 4 lines
Quoted 2 lines

The epub target is removed as the catch-all target contains the same instructions as the epub target we remove in this commit.

So with your patch will the epub target include SVGs or PNGs? Apparently there

I haven't checked but no intended change made to what the epub target will get compared to today, that is you should still have PNGs instead of SVGs. The overridden supported image/figures types are stored in conf.py at the end of the file, I don't modify them so should have the same behavior.

Quoted 9 lines

were issues rendering SVGs in EPUBs as per Michael's commit:

conf.py: use PNG first in EPUB output

SVG directly included in EPUB output has multiple issues, in particular font size and alignment ones (tested on two EPUB readers). Instead, using PNG, generated from SVG when available as the primary format for images. GIF and JPEG are fine too.

Quoted 7 lines
Quoted 4 lines

Ideally, we shouldn't use our in-tree fork but the upstream project sphinxcontrib.rsvgconverter, though it currently only supports generating PDFs from SVGs and we also need PNGs. A merge request to add support for this is pending[5].

Are you willing to send a patch to OE-Core to add a recipe for it?

Yes, I will need to figure out how to build and test this docs toolchain first though :)

Quoted 7 lines

Otherwise: I'm all for using this instead of our Makefile rules, this is much cleaner.

But I can't say whether BSD / IANAL is fine to include in out repo though. I'd rather have a recipe for it if possible! (possibly with your patch on top, if it doesn't get applied?)

No, I will not do that as it'll prevent us from building without the docs toolchain.

If we want to fork the plugin, we'll need to have this made available in a publicly accessible git repo (on git.yoctoproject.org I guess?) so that we can simply pip install the git repo when building without the toolchain (can be done in the Pipfile and documentation/tools/host_packages_scripts/pip3_docs.sh). Then the recipe for the toolchain can be for that fork. I would rather wait for upstream feedback before this happens, hopefully all goes well and we get a new version tagged soon after.

Cheers,
Quentin

#6 lore raw

Re: [docs] [PATCH RFC 3/3] convert SVGs to PDF and PNG using rsvgconverter plugin

Quoted 32 lines · Quentin Schulz

Hi Antonin,

Quoted 3 lines · Antonin Godard

Hi,

On Thu Oct 30, 2025 at 4:17 PM CET, Quentin Schulz wrote:

[...]

Quoted 4 lines
Quoted 2 lines

The epub target is removed as the catch-all target contains the same instructions as the epub target we remove in this commit.

So with your patch will the epub target include SVGs or PNGs? Apparently there

I haven't checked but no intended change made to what the epub target will get compared to today, that is you should still have PNGs instead of SVGs. The overridden supported image/figures types are stored in conf.py at the end of the file, I don't modify them so should have the same behavior.

Quoted 14 lines

were issues rendering SVGs in EPUBs as per Michael's commit:

conf.py: use PNG first in EPUB output

SVG directly included in EPUB output has multiple issues, in particular font size and alignment ones (tested on two EPUB readers). Instead, using PNG, generated from SVG when available as the primary format for images. GIF and JPEG are fine too.

Quoted 4 lines

Ideally, we shouldn't use our in-tree fork but the upstream project sphinxcontrib.rsvgconverter, though it currently only supports generating PDFs from SVGs and we also need PNGs. A merge request to add support for this is pending[5].

Quoted 5 lines
Quoted 2 lines

Are you willing to send a patch to OE-Core to add a recipe for it?

Yes, I will need to figure out how to build and test this docs toolchain first though :)

It's built with this recipe:
https://git.openembedded.org/openembedded-core/tree/meta/recipes-core/meta/buildtools-docs-tarball.bb

You use it like a regular SDK afterwards.

Quoted 11 lines
Quoted 7 lines

Otherwise: I'm all for using this instead of our Makefile rules, this is much cleaner.

But I can't say whether BSD / IANAL is fine to include in out repo though. I'd rather have a recipe for it if possible! (possibly with your patch on top, if it doesn't get applied?)

No, I will not do that as it'll prevent us from building without the docs toolchain.

Quoted 8 lines

If we want to fork the plugin, we'll need to have this made available in a publicly accessible git repo (on git.yoctoproject.org I guess?) so that we can simply pip install the git repo when building without the toolchain (can be done in the Pipfile and documentation/tools/host_packages_scripts/pip3_docs.sh). Then the recipe for the toolchain can be for that fork. I would rather wait for upstream feedback before this happens, hopefully all goes well and we get a new version tagged soon after.

Let's wait for upstream feedback, but in any case I was thinking of adding to the buildtools-docs-tarball recipe (that's for the autobuilder, mainly), and also to documentation/tools/host_packages_scripts/pip3_docs.sh.

Thanks,
Antonin

Signature · 3 lines
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com