public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] distutils-r1.eclass: Add PYTHON_DEPS to DEPEND unconditionally
@ 2023-04-12 15:58 Michał Górny
  2023-04-12 17:00 ` James Le Cuirot
  2023-04-19 10:26 ` Michał Górny
  0 siblings, 2 replies; 3+ messages in thread
From: Michał Górny @ 2023-04-12 15:58 UTC (permalink / raw
  To: gentoo-dev; +Cc: Raul E Rangel, Michał Górny

From: Raul E Rangel <rrangel@chromium.org>

Python distutils packages that build C extensions are currently not
declaring PYTHON_DEPS as part of their DEPEND declaration. This results
in build errors when cross compiling using ROOT=.

i.e.,
   In file included from src/setproctitle.c:14:
   In file included from src/spt.h:15:
   src/spt_python.h:15:10: fatal error: 'Python.h' file not found
   #include <Python.h>
            ^~~~~~~~~~
   1 error generated.

Since the distutils-r1 eclass currently sets the RDEPEND and BDEPEND
variables it makes sense to have the eclass also set the DEPEND
variable. We unconditionally add it to keep the API simple. If in the
future this is problematic, we can maybe add a DISTUTILS_PURE_PYTHON
eclass variable that will omit the DEPEND.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
Closes: https://github.com/gentoo/gentoo/pull/30469
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 09684781de2a..7e9cd6ef9b5a 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -34,8 +34,8 @@
 # functions, you should consider calling the defaults (and especially
 # distutils-r1_python_prepare_all).
 #
-# Please note that distutils-r1 sets RDEPEND and BDEPEND (or DEPEND
-# in earlier EAPIs) unconditionally for you.
+# Please note that distutils-r1 sets BDEPEND, DEPEND, and RDEPEND
+# unconditionally for you.
 #
 # Also, please note that distutils-r1 will always inherit python-r1
 # as well. Thus, all the variables defined and documented there are
@@ -307,6 +307,12 @@ _distutils_set_globals() {
 	fi
 
 	if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
+		# This dependency is only required for packages that build
+		# C extensions. It was deemed cleaner to unconditionally
+		# add the dependency than add it to the individual
+		# ebuilds that need it.
+		DEPEND="${PYTHON_DEPS}"
+
 		RDEPEND="${PYTHON_DEPS} ${rdep}"
 		BDEPEND="${PYTHON_DEPS} ${bdep}"
 		REQUIRED_USE=${PYTHON_REQUIRED_USE}
-- 
2.40.0



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

* Re: [gentoo-dev] [PATCH] distutils-r1.eclass: Add PYTHON_DEPS to DEPEND unconditionally
  2023-04-12 15:58 [gentoo-dev] [PATCH] distutils-r1.eclass: Add PYTHON_DEPS to DEPEND unconditionally Michał Górny
@ 2023-04-12 17:00 ` James Le Cuirot
  2023-04-19 10:26 ` Michał Górny
  1 sibling, 0 replies; 3+ messages in thread
From: James Le Cuirot @ 2023-04-12 17:00 UTC (permalink / raw
  To: gentoo-dev

On 12 April 2023 16:58:58 BST, "Michał Górny" <mgorny@gentoo.org> wrote:
>From: Raul E Rangel <rrangel@chromium.org>
>
>Python distutils packages that build C extensions are currently not
>declaring PYTHON_DEPS as part of their DEPEND declaration. This results
>in build errors when cross compiling using ROOT=.
>
>i.e.,
>   In file included from src/setproctitle.c:14:
>   In file included from src/spt.h:15:
>   src/spt_python.h:15:10: fatal error: 'Python.h' file not found
>   #include <Python.h>
>            ^~~~~~~~~~
>   1 error generated.
>
>Since the distutils-r1 eclass currently sets the RDEPEND and BDEPEND
>variables it makes sense to have the eclass also set the DEPEND
>variable. We unconditionally add it to keep the API simple. If in the
>future this is problematic, we can maybe add a DISTUTILS_PURE_PYTHON
>eclass variable that will omit the DEPEND.
>
>Signed-off-by: Raul E Rangel <rrangel@chromium.org>
>Closes: https://github.com/gentoo/gentoo/pull/30469
>Signed-off-by: Michał Górny <mgorny@gentoo.org>
>---
> eclass/distutils-r1.eclass | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
>diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
>index 09684781de2a..7e9cd6ef9b5a 100644
>--- a/eclass/distutils-r1.eclass
>+++ b/eclass/distutils-r1.eclass
>@@ -34,8 +34,8 @@
> # functions, you should consider calling the defaults (and especially
> # distutils-r1_python_prepare_all).
> #
>-# Please note that distutils-r1 sets RDEPEND and BDEPEND (or DEPEND
>-# in earlier EAPIs) unconditionally for you.
>+# Please note that distutils-r1 sets BDEPEND, DEPEND, and RDEPEND
>+# unconditionally for you.
> #
> # Also, please note that distutils-r1 will always inherit python-r1
> # as well. Thus, all the variables defined and documented there are
>@@ -307,6 +307,12 @@ _distutils_set_globals() {
> 	fi
> 
> 	if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
>+		# This dependency is only required for packages that build
>+		# C extensions. It was deemed cleaner to unconditionally
>+		# add the dependency than add it to the individual
>+		# ebuilds that need it.
>+		DEPEND="${PYTHON_DEPS}"
>+
> 		RDEPEND="${PYTHON_DEPS} ${rdep}"
> 		BDEPEND="${PYTHON_DEPS} ${bdep}"
> 		REQUIRED_USE=${PYTHON_REQUIRED_USE}

I think that's reasonable.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


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

* Re: [gentoo-dev] [PATCH] distutils-r1.eclass: Add PYTHON_DEPS to DEPEND unconditionally
  2023-04-12 15:58 [gentoo-dev] [PATCH] distutils-r1.eclass: Add PYTHON_DEPS to DEPEND unconditionally Michał Górny
  2023-04-12 17:00 ` James Le Cuirot
@ 2023-04-19 10:26 ` Michał Górny
  1 sibling, 0 replies; 3+ messages in thread
From: Michał Górny @ 2023-04-19 10:26 UTC (permalink / raw
  To: gentoo-dev; +Cc: Raul E Rangel

On Wed, 2023-04-12 at 17:58 +0200, Michał Górny wrote:
> From: Raul E Rangel <rrangel@chromium.org>
> 
> Python distutils packages that build C extensions are currently not
> declaring PYTHON_DEPS as part of their DEPEND declaration. This results
> in build errors when cross compiling using ROOT=.
> 
> i.e.,
>    In file included from src/setproctitle.c:14:
>    In file included from src/spt.h:15:
>    src/spt_python.h:15:10: fatal error: 'Python.h' file not found
>    #include <Python.h>
>             ^~~~~~~~~~
>    1 error generated.
> 
> Since the distutils-r1 eclass currently sets the RDEPEND and BDEPEND
> variables it makes sense to have the eclass also set the DEPEND
> variable. We unconditionally add it to keep the API simple. If in the
> future this is problematic, we can maybe add a DISTUTILS_PURE_PYTHON
> eclass variable that will omit the DEPEND.
> 
> Signed-off-by: Raul E Rangel <rrangel@chromium.org>
> Closes: https://github.com/gentoo/gentoo/pull/30469
> Signed-off-by: Michał Górny <mgorny@gentoo.org>
> ---
>  eclass/distutils-r1.eclass | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
> index 09684781de2a..7e9cd6ef9b5a 100644
> --- a/eclass/distutils-r1.eclass
> +++ b/eclass/distutils-r1.eclass
> @@ -34,8 +34,8 @@
>  # functions, you should consider calling the defaults (and especially
>  # distutils-r1_python_prepare_all).
>  #
> -# Please note that distutils-r1 sets RDEPEND and BDEPEND (or DEPEND
> -# in earlier EAPIs) unconditionally for you.
> +# Please note that distutils-r1 sets BDEPEND, DEPEND, and RDEPEND
> +# unconditionally for you.
>  #
>  # Also, please note that distutils-r1 will always inherit python-r1
>  # as well. Thus, all the variables defined and documented there are
> @@ -307,6 +307,12 @@ _distutils_set_globals() {
>  	fi
>  
>  	if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
> +		# This dependency is only required for packages that build
> +		# C extensions. It was deemed cleaner to unconditionally
> +		# add the dependency than add it to the individual
> +		# ebuilds that need it.
> +		DEPEND="${PYTHON_DEPS}"
> +
>  		RDEPEND="${PYTHON_DEPS} ${rdep}"
>  		BDEPEND="${PYTHON_DEPS} ${bdep}"
>  		REQUIRED_USE=${PYTHON_REQUIRED_USE}

Actually, I'm withdrawing this one.  We'd be adding a dedicated variable
controlling this, and a few other features specific to packages
installing Python extensions.

-- 
Best regards,
Michał Górny



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

end of thread, other threads:[~2023-04-19 10:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-12 15:58 [gentoo-dev] [PATCH] distutils-r1.eclass: Add PYTHON_DEPS to DEPEND unconditionally Michał Górny
2023-04-12 17:00 ` James Le Cuirot
2023-04-19 10:26 ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox