Skip to contentSkip to conversation

buildtools-docs-tarball: add new Sphinx extension svg2pdfconverter

PATCH Superseded Quentin Schulz 3 participants 5 messages Dec 2, 2025 – Dec 3, 2025

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover buildtools-docs-tarball: add new Sphinx extension svg2pdfconverter

This will soon be required to build the Yocto docs, so add a recipe for the Sphinx extension and add it to the docs tarball.

---
Changes in v2:
- fixed incorrect PYPI_PACKAGE that was set by devtool add,
- fixed default UPSTREAM_CHECK_PYPI_PACKAGE so latest version is found, sphinxcontrib-svg2pdfconverter (the default) is used only until 1.2.2 (included),
- Link to v1: https://patch.msgid.link/[email protected]

---
Quentin Schulz (2):
python3-sphinxcontrib-svg2pdfconverter: add new recipe
buildtools-docs-tarball: add python3-sphinxcontrib-svg2pdfconverter to the SDK

 meta/recipes-core/meta/buildtools-docs-tarball.bb    |  1 +
 .../python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb  | 20 ++++++++++++++++++++
 scripts/lib/recipetool/create_buildsys_python.py     |  8 ++++++--
 3 files changed, 27 insertions(+), 2 deletions(-)

---
base-commit: ac7327583aef83fd400190506f3147623de38b68
change-id: 20251202-svg2pdf-e35074cd8cea

Best regards,

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

PATCH v2 1/2 python3-sphinxcontrib-svg2pdfconverter: add new recipe

From: Quentin Schulz <[email protected]>

This will be a dependency for building the Yocto docs soon, so let's add a recipe for it.

This does SVG to PDF (or PNG) conversion for images used in Sphinx projects.

It exposes three different Sphinx extensions, each using a different tool for the conversion:
- cairosvg, a Python module with no available recipe,
- inkscape, only available in seemingly unmaintained 3rd party layer,
- rsvg-convert,

So we'll only support the last extension for now.

---
 .../python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb  | 20 ++++++++++++++++++++
 scripts/lib/recipetool/create_buildsys_python.py     |  8 ++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)
meta/recipes-devtools/python/python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb new file +20 -0
new file mode 100644
index 0000000000..c686ebff23
@@ -0,0 +1,20 @@
+SUMMARY = "Sphinx SVG to PDF or PNG converter extension"
+HOMEPAGE = "https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=b11cf936853a71258d4b57bb1849a3f9"
+
+SRC_URI[sha256sum] = "ab9c8f1080391e231812d20abf2657a69ee35574563b1014414f953964a95fa3"
+
+inherit pypi python_setuptools_build_meta
+
+PYPI_PACKAGE = "sphinxcontrib_svg2pdfconverter"
+UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"
+
+RDEPENDS:${PN} = "python3-sphinx"
+# Only support sphinxcontrib.rsvgconverter for now.
+# As cairosvgconverter depends on cairosvg module, no recipe available yet
+# As inkscapeconverter depends on inkscape, recipe in meta-office, 3rd-party
+# layer not updated in years
+RDEPENDS:${PN} += "librsvg"
+
+BBCLASSEXTEND = "native nativesdk"
scripts/lib/recipetool/create_buildsys_python.py +6 -2
index a807dafae5..c6a40f5a7d 100644
@@ -858,10 +858,14 @@ class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler):
             if metadata:
                 for field, values in metadata.items():
                     if field == "license":
-                        # For setuptools.build_meta and flit, licence is a table
+                        # For flit, licence is a table
+                        # For setuptools.build_meta, license can be:
+                        #  - an SPDX license expression as string, since PEP-0639,
+                        #  - a table, pre-PEP-0639,
                         # but for poetry licence is a string
                         # for hatchling, both table (jsonschema) and string (iniconfig) have been used
-                        if build_backend == "poetry.core.masonry.api":
+                        if build_backend == "poetry.core.masonry.api" or \
+                                (build_backend == "setuptools.build_meta" and type(values) == str):
                             value = values
                         else:
                             value = values.get("text", "")
Signature · 1 line
2.52.0
#2 lore raw

Re: [PATCH v2 1/2] python3-sphinxcontrib-svg2pdfconverter: add new recipe

Hi,

Quoted 38 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

This will be a dependency for building the Yocto docs soon, so let's add a recipe for it.

This does SVG to PDF (or PNG) conversion for images used in Sphinx projects.

It exposes three different Sphinx extensions, each using a different tool for the conversion:
- cairosvg, a Python module with no available recipe,
- inkscape, only available in seemingly unmaintained 3rd party layer,
- rsvg-convert,

So we'll only support the last extension for now.

---
 .../python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb  | 20 ++++++++++++++++++++
 scripts/lib/recipetool/create_buildsys_python.py     |  8 ++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)
meta/recipes-devtools/python/python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb new file +10 -0
new file mode 100644
index 0000000000..c686ebff23
@@ -0,0 +1,20 @@
+SUMMARY = "Sphinx SVG to PDF or PNG converter extension"
+HOMEPAGE = "https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=b11cf936853a71258d4b57bb1849a3f9"
+
+SRC_URI[sha256sum] = "ab9c8f1080391e231812d20abf2657a69ee35574563b1014414f953964a95fa3"
+
+inherit pypi python_setuptools_build_meta
+
+PYPI_PACKAGE = "sphinxcontrib_svg2pdfconverter"

meta/recipes-devtools/python/python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb line 20

Quoted 10 lines
meta/recipes-devtools/python/python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb new file +10 -0
+UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"
+
+RDEPENDS:${PN} = "python3-sphinx"
+# Only support sphinxcontrib.rsvgconverter for now.
+# As cairosvgconverter depends on cairosvg module, no recipe available yet
+# As inkscapeconverter depends on inkscape, recipe in meta-office, 3rd-party
+# layer not updated in years
+RDEPENDS:${PN} += "librsvg"
+
+BBCLASSEXTEND = "native nativesdk"

Patchtest should have seen this, but you need to add an entry for the recipe in meta/conf/distro/include/maintainers.inc. I can assign myself otherwise as I maintain some of the other docs related recipes.

Quoted 8 lines
scripts/lib/recipetool/create_buildsys_python.py +0 -0
index a807dafae5..c6a40f5a7d 100644
@@ -858,10 +858,14 @@ class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler):
             if metadata:
                 for field, values in metadata.items():
                     if field == "license":

scripts/lib/recipetool/create_buildsys_python.py class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler): · line 868

Quoted 10 lines
scripts/lib/recipetool/create_buildsys_python.py +6 -2
-                        # For setuptools.build_meta and flit, licence is a table
+                        # For flit, licence is a table
+                        # For setuptools.build_meta, license can be:
+                        #  - an SPDX license expression as string, since PEP-0639,
+                        #  - a table, pre-PEP-0639,
                         # but for poetry licence is a string
                         # for hatchling, both table (jsonschema) and string (iniconfig) have been used
-                        if build_backend == "poetry.core.masonry.api":
+                        if build_backend == "poetry.core.masonry.api" or \
+                                (build_backend == "setuptools.build_meta" and type(values) == str):

Should this be sent in a separate patch? It looks like it's fixing a bug in recipetool, there's no explanation about it in your commit message.

Otherwise, I was able to build the tarball and test building the docs with it (and your other docs patch)!

Thanks,
Antonin

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

Re: [PATCH v2 1/2] python3-sphinxcontrib-svg2pdfconverter: add new recipe

Hi Antonin,

Quoted 47 lines · Antonin Godard

Hi,

Quoted 44 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

This will be a dependency for building the Yocto docs soon, so let's add a recipe for it.

This does SVG to PDF (or PNG) conversion for images used in Sphinx projects.

It exposes three different Sphinx extensions, each using a different tool for the conversion:
- cairosvg, a Python module with no available recipe,
- inkscape, only available in seemingly unmaintained 3rd party layer,
- rsvg-convert,

So we'll only support the last extension for now.

---
  .../python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb  | 20 ++++++++++++++++++++
  scripts/lib/recipetool/create_buildsys_python.py     |  8 ++++++--
  2 files changed, 26 insertions(+), 2 deletions(-)
meta/recipes-devtools/python/python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb new file +16 -0
new file mode 100644
index 0000000000..c686ebff23
@@ -0,0 +1,20 @@
+SUMMARY = "Sphinx SVG to PDF or PNG converter extension"
+HOMEPAGE = "https://github.com/missinglinkelectronics/sphinxcontrib-svg2pdfconverter"
+LICENSE = "BSD-2-Clause"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=b11cf936853a71258d4b57bb1849a3f9"
+
+SRC_URI[sha256sum] = "ab9c8f1080391e231812d20abf2657a69ee35574563b1014414f953964a95fa3"
+
+inherit pypi python_setuptools_build_meta
+
+PYPI_PACKAGE = "sphinxcontrib_svg2pdfconverter"
+UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"
+
+RDEPENDS:${PN} = "python3-sphinx"
+# Only support sphinxcontrib.rsvgconverter for now.
+# As cairosvgconverter depends on cairosvg module, no recipe available yet
+# As inkscapeconverter depends on inkscape, recipe in meta-office, 3rd-party
Quoted 9 lines

meta/recipes-devtools/python/python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb line 20

Quoted 4 lines
meta/recipes-devtools/python/python3-sphinxcontrib-svg2pdfconverter_2.0.0.bb new file +4 -0
+# layer not updated in years
+RDEPENDS:${PN} += "librsvg"
+
+BBCLASSEXTEND = "native nativesdk"

Patchtest should have seen this, but you need to add an entry for the recipe in meta/conf/distro/include/maintainers.inc. I can assign myself otherwise as I maintain some of the other docs related recipes.

I'll add yourself since you don't mind, thanks!

Quoted 13 lines
Quoted 13 lines
scripts/lib/recipetool/create_buildsys_python.py +4 -1
index a807dafae5..c6a40f5a7d 100644
@@ -858,10 +858,14 @@ class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler):
              if metadata:
                  for field, values in metadata.items():
                      if field == "license":
-                        # For setuptools.build_meta and flit, licence is a table
+                        # For flit, licence is a table
+                        # For setuptools.build_meta, license can be:
+                        #  - an SPDX license expression as string, since PEP-0639,
+                        #  - a table, pre-PEP-0639,
Quoted 9 lines

scripts/lib/recipetool/create_buildsys_python.py class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler): · line 868

Quoted 5 lines
scripts/lib/recipetool/create_buildsys_python.py +2 -1
                          # but for poetry licence is a string
                          # for hatchling, both table (jsonschema) and string (iniconfig) have been used
-                        if build_backend == "poetry.core.masonry.api":
+                        if build_backend == "poetry.core.masonry.api" or \
+                                (build_backend == "setuptools.build_meta" and type(values) == str):

Should this be sent in a separate patch? It looks like it's fixing a bug in recipetool, there's no explanation about it in your commit message.

Sigh... I was working on this after sending the v1 and forgot to stash it before preparing the v2. I'll send a v3, thanks for catching this one.

Cheers,
Quentin

#4 lore raw

PATCH v2 2/2 buildtools-docs-tarball: add python3-sphinxcontrib-svg2pdfconverter to the SDK

In reply to Quentin Schulz

From: Quentin Schulz <[email protected]>

This will soon be required for building the Yocto docs so let's add it to the SDK toolchain.

---
 meta/recipes-core/meta/buildtools-docs-tarball.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/meta/buildtools-docs-tarball.bb +1 -0
index 98d47f7b71..3fc28fad93 100644
@@ -10,6 +10,7 @@ TOOLCHAIN_HOST_TASK += "\
     nativesdk-python3-sphinx-argparse \
     nativesdk-python3-sphinx-copybutton \
     nativesdk-python3-sphinx-rtd-theme \
+    nativesdk-python3-sphinxcontrib-svg2pdfconverter \
     nativesdk-python3-pyyaml \
     nativesdk-rsvg \
     "
Signature · 1 line
2.52.0