[v3] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package

Message ID 20240208205550.984-1-thorsten.blum@toblux.com
State New
Headers
Series [v3] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package |

Commit Message

Thorsten Blum Feb. 8, 2024, 8:55 p.m. UTC
  The Python module pyyaml is required to build the docs, but it is only
listed in Documentation/sphinx/requirements.txt and is therefore missing
when Sphinx is installed as a package and not via pip/pypi.

Add pyyaml as an optional package for multiple distros to fix building the
docs if you prefer to install Sphinx as a package.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: Vegard Nossum <vegard.nossum@oracle.com>
Tested-by: Vegard Nossum <vegard.nossum@oracle.com>
---
Changes in v2:
- s/pyyaml/yaml/ as suggested by Vegard Nossum
- Make the check require the Python module; was optional

Changes in v3:
- Preserve Reviewed-by: and Tested-by: tags
- Add pyyaml to openSUSE as suggested by Vegard Nossum
---
 scripts/sphinx-pre-install | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Jonathan Corbet Feb. 14, 2024, 10:32 p.m. UTC | #1
Thorsten Blum <thorsten.blum@toblux.com> writes:

> The Python module pyyaml is required to build the docs, but it is only
> listed in Documentation/sphinx/requirements.txt and is therefore missing
> when Sphinx is installed as a package and not via pip/pypi.
>
> Add pyyaml as an optional package for multiple distros to fix building the
> docs if you prefer to install Sphinx as a package.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> Reviewed-by: Vegard Nossum <vegard.nossum@oracle.com>
> Tested-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
> Changes in v2:
> - s/pyyaml/yaml/ as suggested by Vegard Nossum
> - Make the check require the Python module; was optional
>
> Changes in v3:
> - Preserve Reviewed-by: and Tested-by: tags
> - Add pyyaml to openSUSE as suggested by Vegard Nossum
> ---
>  scripts/sphinx-pre-install | 4 ++++
>  1 file changed, 4 insertions(+)

Applied, thanks.

jon
  

Patch

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 25aefbb35377..88ae75887476 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -361,6 +361,7 @@  sub give_debian_hints()
 {
 	my %map = (
 		"python-sphinx"		=> "python3-sphinx",
+		"yaml"			=> "python3-yaml",
 		"ensurepip"		=> "python3-venv",
 		"virtualenv"		=> "virtualenv",
 		"dot"			=> "graphviz",
@@ -395,6 +396,7 @@  sub give_redhat_hints()
 {
 	my %map = (
 		"python-sphinx"		=> "python3-sphinx",
+		"yaml"			=> "python3-pyyaml",
 		"virtualenv"		=> "python3-virtualenv",
 		"dot"			=> "graphviz",
 		"convert"		=> "ImageMagick",
@@ -472,6 +474,7 @@  sub give_opensuse_hints()
 {
 	my %map = (
 		"python-sphinx"		=> "python3-sphinx",
+		"yaml"			=> "python3-pyyaml",
 		"virtualenv"		=> "python3-virtualenv",
 		"dot"			=> "graphviz",
 		"convert"		=> "ImageMagick",
@@ -951,6 +954,7 @@  sub check_needs()
 
 	# Check for needed programs/tools
 	check_perl_module("Pod::Usage", 0);
+	check_python_module("yaml", 0);
 	check_program("make", 0);
 	check_program("gcc", 0);
 	check_program("dot", 1);