All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package
@ 2024-02-07 11:12 Thorsten Blum
  2024-02-08 10:21 ` Vegard Nossum
  0 siblings, 1 reply; 7+ messages in thread
From: Thorsten Blum @ 2024-02-07 11:12 UTC (permalink / raw)
  To: Jonathan Corbet, Mauro Carvalho Chehab
  Cc: linux-doc, linux-kernel, Thorsten Blum

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 Debian- and Red Hat-based distros to
fix building the docs if you prefer to install Sphinx as a package.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 scripts/sphinx-pre-install | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 25aefbb35377..7905beab3359 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",
+		"pyyaml"		=> "python3-yaml",
 		"ensurepip"		=> "python3-venv",
 		"virtualenv"		=> "virtualenv",
 		"dot"			=> "graphviz",
@@ -395,6 +396,7 @@ sub give_redhat_hints()
 {
 	my %map = (
 		"python-sphinx"		=> "python3-sphinx",
+		"pyyaml"		=> "python3-pyyaml",
 		"virtualenv"		=> "python3-virtualenv",
 		"dot"			=> "graphviz",
 		"convert"		=> "ImageMagick",
@@ -955,6 +957,7 @@ sub check_needs()
 	check_program("gcc", 0);
 	check_program("dot", 1);
 	check_program("convert", 1);
+	check_python_module("pyyaml", 1);
 
 	# Extra PDF files - should use 2 for is_optional
 	check_program("xelatex", 2) if ($pdf);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package
  2024-02-07 11:12 [PATCH] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package Thorsten Blum
@ 2024-02-08 10:21 ` Vegard Nossum
  2024-02-08 13:13   ` [PATCH v2] " Thorsten Blum
  0 siblings, 1 reply; 7+ messages in thread
From: Vegard Nossum @ 2024-02-08 10:21 UTC (permalink / raw)
  To: Thorsten Blum, Jonathan Corbet, Mauro Carvalho Chehab
  Cc: linux-doc, linux-kernel


On 07/02/2024 12:12, Thorsten Blum wrote:
> 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 Debian- and Red Hat-based distros to
> fix building the docs if you prefer to install Sphinx as a package.

Thanks for fixing this!

> @@ -955,6 +957,7 @@ sub check_needs()
>   	check_program("gcc", 0);
>   	check_program("dot", 1);
>   	check_program("convert", 1);
> +	check_python_module("pyyaml", 1);

Shouldn't this be just "yaml" instead of "pyyaml"? check_python_module()
is going to "import" that argument and the Python module itself is just
called "yaml".

Hm, but then it's going to add "yaml" to %missing, which keys on
packages, not modules... Maybe add an optional argument to
check_python_module() so that it knows both the Python module name and
the package name?

As usual, I could be wrong...


Vegard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package
  2024-02-08 10:21 ` Vegard Nossum
@ 2024-02-08 13:13   ` Thorsten Blum
  2024-02-08 16:37     ` Vegard Nossum
  0 siblings, 1 reply; 7+ messages in thread
From: Thorsten Blum @ 2024-02-08 13:13 UTC (permalink / raw)
  To: vegard.nossum; +Cc: corbet, linux-doc, linux-kernel, mchehab, thorsten.blum

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 Debian- and Red Hat-based distros to
fix building the docs if you prefer to install Sphinx as a package.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
Changes in v2:
- s/pyyaml/yaml/ as suggested by Vegard Nossum <vegard.nossum@oracle.com>
- Make the check require the Python module; was optional
---
 scripts/sphinx-pre-install | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 25aefbb35377..7e49a020c25e 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",
@@ -951,6 +953,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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package
  2024-02-08 13:13   ` [PATCH v2] " Thorsten Blum
@ 2024-02-08 16:37     ` Vegard Nossum
  2024-02-08 20:15       ` Thorsten Blum
  0 siblings, 1 reply; 7+ messages in thread
From: Vegard Nossum @ 2024-02-08 16:37 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: corbet, linux-doc, linux-kernel, mchehab


On 08/02/2024 14:13, Thorsten Blum wrote:
> 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 Debian- and Red Hat-based distros to
s/optional/required/ ? Given...

> fix building the docs if you prefer to install Sphinx as a package.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
> Changes in v2:
> - s/pyyaml/yaml/ as suggested by Vegard Nossum <vegard.nossum@oracle.com>
> - Make the check require the Python module; was optional

...this ^

> ---
>   scripts/sphinx-pre-install | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
> index 25aefbb35377..7e49a020c25e 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",
> @@ -951,6 +953,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);

This seems to work.

Reviewed-by: Vegard Nossum <vegard.nossum@oracle.com>
Tested-by: Vegard Nossum <vegard.nossum@oracle.com>

Can/should we add it to give_opensuse_hints() as well, given that it
also apparently allows you to install Sphinx via the distro package
manager? (Not sure about mageia/arch/gentoo.)


Vegard

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package
  2024-02-08 16:37     ` Vegard Nossum
@ 2024-02-08 20:15       ` Thorsten Blum
  2024-02-08 20:55         ` [PATCH v3] " Thorsten Blum
  0 siblings, 1 reply; 7+ messages in thread
From: Thorsten Blum @ 2024-02-08 20:15 UTC (permalink / raw)
  To: Vegard Nossum; +Cc: corbet, linux-doc, linux-kernel, mchehab


> On Feb 8, 2024, at 17:37, Vegard Nossum <vegard.nossum@oracle.com> wrote:
> 
> On 08/02/2024 14:13, Thorsten Blum wrote:
>> 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 Debian- and Red Hat-based distros to
> s/optional/required/ ? Given...

The commit message should be correct. The system package is optional, but the
Python module itself is required.

> Can/should we add it to give_opensuse_hints() as well, given that it
> also apparently allows you to install Sphinx via the distro package
> manager? (Not sure about mageia/arch/gentoo.)

Yes, I'll submit a v3 shortly.

Thanks,
Thorsten

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package
  2024-02-08 20:15       ` Thorsten Blum
@ 2024-02-08 20:55         ` Thorsten Blum
  2024-02-14 22:32           ` Jonathan Corbet
  0 siblings, 1 reply; 7+ messages in thread
From: Thorsten Blum @ 2024-02-08 20:55 UTC (permalink / raw)
  To: corbet, mchehab; +Cc: linux-doc, linux-kernel, vegard.nossum, Thorsten Blum

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(+)

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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package
  2024-02-08 20:55         ` [PATCH v3] " Thorsten Blum
@ 2024-02-14 22:32           ` Jonathan Corbet
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Corbet @ 2024-02-14 22:32 UTC (permalink / raw)
  To: Thorsten Blum, mchehab
  Cc: linux-doc, linux-kernel, vegard.nossum, Thorsten Blum

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-02-14 22:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 11:12 [PATCH] docs: scripts: sphinx-pre-install: Fix building docs with pyyaml package Thorsten Blum
2024-02-08 10:21 ` Vegard Nossum
2024-02-08 13:13   ` [PATCH v2] " Thorsten Blum
2024-02-08 16:37     ` Vegard Nossum
2024-02-08 20:15       ` Thorsten Blum
2024-02-08 20:55         ` [PATCH v3] " Thorsten Blum
2024-02-14 22:32           ` Jonathan Corbet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.