All of lore.kernel.org
 help / color / mirror / Atom feed
* [dunfell 1/5] python3: split python target configuration into own class
@ 2020-12-01 16:26 ernstp
  2020-12-01 16:26 ` [dunfell 2/5] python3-pycairo: use python3targetconfig Ernst Sjöstrand
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: ernstp @ 2020-12-01 16:26 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin, Richard Purdie

From: Alexander Kanavin <alex.kanavin@gmail.com>

Setting _PYTHON_SYSCONFIGDATA_NAME in python3native class globally was
problematic as it was leaking into host python environment, which
was causing tracebacks depending on host distro and action
(typically anything involving importing sysconfig module).

The new class sets the variable only in specific tasks where it is needed,
and should be inherited explicitly:
- use python3native to run scripts with native python
- use python3targetconfig to run scripts with native python
if those scripts need to access target config data (such
as correct installation directories). This also adds a dependency
on target python, so should be used carefully to avoid lengthening builds.

(From OE-Core rev: 5a118d4e7985fa88f04c3611f8db813f0dafce75)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit c9f7ed88a946078c27fa1a62d54d6310fad9d37a)
---
 meta/classes/python3native.bbclass       |  2 --
 meta/classes/python3targetconfig.bbclass | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 meta/classes/python3targetconfig.bbclass

diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass
index d98fb4c758..2e3a88c126 100644
--- a/meta/classes/python3native.bbclass
+++ b/meta/classes/python3native.bbclass
@@ -17,8 +17,6 @@ export STAGING_LIBDIR
 export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
 export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
 
-export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-
 # suppress host user's site-packages dirs.
 export PYTHONNOUSERSITE = "1"
 
diff --git a/meta/classes/python3targetconfig.bbclass b/meta/classes/python3targetconfig.bbclass
new file mode 100644
index 0000000000..640d0c97b6
--- /dev/null
+++ b/meta/classes/python3targetconfig.bbclass
@@ -0,0 +1,15 @@
+inherit python3native
+
+DEPENDS_append = " python3"
+
+do_configure_prepend() {
+        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
+}
+
+do_compile_prepend() {
+        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
+}
+
+do_install_prepend() {
+        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
+}
-- 
2.29.2


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

* [dunfell 2/5] python3-pycairo: use python3targetconfig
  2020-12-01 16:26 [dunfell 1/5] python3: split python target configuration into own class ernstp
@ 2020-12-01 16:26 ` Ernst Sjöstrand
  2020-12-01 16:26 ` [dunfell 3/5] distutils3-base.bbclass: " Ernst Sjöstrand
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Ernst Sjöstrand @ 2020-12-01 16:26 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin, Richard Purdie

From: Alexander Kanavin <alex.kanavin@gmail.com>

(From OE-Core rev: dadf001c85938b831def8da5851a40dc0977e3d0)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 5077e7abbacf639f63bd444517d1d59a27d502a1)
---
 meta/recipes-devtools/python/python3-pycairo_1.19.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3-pycairo_1.19.0.bb b/meta/recipes-devtools/python/python3-pycairo_1.19.0.bb
index 8f60834c17..8452d7fa9f 100644
--- a/meta/recipes-devtools/python/python3-pycairo_1.19.0.bb
+++ b/meta/recipes-devtools/python/python3-pycairo_1.19.0.bb
@@ -18,7 +18,7 @@ SRC_URI[sha256sum] = "4f5ba9374a46c98729dd3727d993f5e17ed0286fd6738ed464fe4efa06
 
 S = "${WORKDIR}/pycairo-${PV}"
 
-inherit meson pkgconfig
+inherit meson pkgconfig python3targetconfig
 
 CFLAGS += "-fPIC"
 
-- 
2.29.2


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

* [dunfell 3/5] distutils3-base.bbclass: use python3targetconfig
  2020-12-01 16:26 [dunfell 1/5] python3: split python target configuration into own class ernstp
  2020-12-01 16:26 ` [dunfell 2/5] python3-pycairo: use python3targetconfig Ernst Sjöstrand
@ 2020-12-01 16:26 ` Ernst Sjöstrand
  2020-12-01 16:26 ` [dunfell 4/5] meta: drop _PYTHON_SYSCONFIGDATA_NAME hacks Ernst Sjöstrand
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Ernst Sjöstrand @ 2020-12-01 16:26 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin, Richard Purdie

From: Alexander Kanavin <alex.kanavin@gmail.com>

(From OE-Core rev: 9c8f666097802cb594a759989edcf01603a22df3)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 3ec7f79ad2687381300010392c3320cca0dc638e)
---
 meta/classes/distutils3-base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/distutils3-base.bbclass b/meta/classes/distutils3-base.bbclass
index 7dbf07ac4b..a277d1c7bc 100644
--- a/meta/classes/distutils3-base.bbclass
+++ b/meta/classes/distutils3-base.bbclass
@@ -1,5 +1,5 @@
 DEPENDS  += "${@["${PYTHON_PN}-native ${PYTHON_PN}", ""][(d.getVar('PACKAGES') == '')]}"
 RDEPENDS_${PN} += "${@['', '${PYTHON_PN}-core']['${CLASSOVERRIDE}' == 'class-target']}"
 
-inherit distutils-common-base python3native
+inherit distutils-common-base python3native python3targetconfig
 
-- 
2.29.2


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

* [dunfell 4/5] meta: drop _PYTHON_SYSCONFIGDATA_NAME hacks
  2020-12-01 16:26 [dunfell 1/5] python3: split python target configuration into own class ernstp
  2020-12-01 16:26 ` [dunfell 2/5] python3-pycairo: use python3targetconfig Ernst Sjöstrand
  2020-12-01 16:26 ` [dunfell 3/5] distutils3-base.bbclass: " Ernst Sjöstrand
@ 2020-12-01 16:26 ` Ernst Sjöstrand
  2020-12-01 16:26 ` [dunfell 5/5] gpgme: use python3targetconfig Ernst Sjöstrand
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Ernst Sjöstrand @ 2020-12-01 16:26 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin, Richard Purdie

From: Alexander Kanavin <alex.kanavin@gmail.com>

(From OE-Core rev: d3a81dd0e72a3495bfc7cc969c2bb806b666023d)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit acfdab8daa3a67ebabc65fb7e152cc3a476b4333)
---
 meta/classes/scons.bbclass          | 3 ---
 meta/lib/oe/prservice.py            | 4 ----
 meta/recipes-core/glib-2.0/glib.inc | 4 ----
 meta/recipes-graphics/mesa/mesa.inc | 5 -----
 4 files changed, 16 deletions(-)

diff --git a/meta/classes/scons.bbclass b/meta/classes/scons.bbclass
index 6b171ca8df..4f3ae502ef 100644
--- a/meta/classes/scons.bbclass
+++ b/meta/classes/scons.bbclass
@@ -5,7 +5,6 @@ DEPENDS += "python3-scons-native"
 EXTRA_OESCONS ?= ""
 
 do_configure() {
-	unset _PYTHON_SYSCONFIGDATA_NAME
 	if [ -n "${CONFIGURESTAMPFILE}" ]; then
 		if [ -e "${CONFIGURESTAMPFILE}" -a "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a "${CLEANBROKEN}" != "1" ]; then
 			${STAGING_BINDIR_NATIVE}/scons --clean PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS}
@@ -17,13 +16,11 @@ do_configure() {
 }
 
 scons_do_compile() {
-	unset _PYTHON_SYSCONFIGDATA_NAME
 	${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} || \
 	die "scons build execution failed."
 }
 
 scons_do_install() {
-	unset _PYTHON_SYSCONFIGDATA_NAME
 	${STAGING_BINDIR_NATIVE}/scons install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} install || \
 	die "scons install execution failed."
 }
diff --git a/meta/lib/oe/prservice.py b/meta/lib/oe/prservice.py
index 2d3c9c7e50..fcdbe66c19 100644
--- a/meta/lib/oe/prservice.py
+++ b/meta/lib/oe/prservice.py
@@ -3,10 +3,6 @@
 #
 
 def prserv_make_conn(d, check = False):
-    # Otherwise this fails when called from recipes which e.g. inherit python3native (which sets _PYTHON_SYSCONFIGDATA_NAME) with:
-    # No module named '_sysconfigdata'
-    if '_PYTHON_SYSCONFIGDATA_NAME' in os.environ:
-        del os.environ['_PYTHON_SYSCONFIGDATA_NAME']
     import prserv.serv
     host_params = list([_f for _f in (d.getVar("PRSERV_HOST") or '').split(':') if _f])
     try:
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index 7ebed0e5fd..c3ddf18387 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -32,10 +32,6 @@ inherit meson gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bas
 
 GTKDOC_MESON_OPTION = "gtk_doc"
 
-# This avoids the need to depend on target python3, which in case of mingw is not even possible.
-# meson's python configuration pokes into python3 configuration, so this provides the native config to it.
-unset _PYTHON_SYSCONFIGDATA_NAME
-
 S = "${WORKDIR}/glib-${PV}"
 
 PACKAGECONFIG ??= "system-pcre libmount \
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index b7ef496fdc..a1bf878b1a 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -26,11 +26,6 @@ PROVIDES = " \
 
 inherit meson pkgconfig python3native gettext features_check
 
-# Unset these to stop python trying to report the target Python setup
-_PYTHON_SYSCONFIGDATA_NAME[unexport] = "1"
-STAGING_INCDIR[unexport] = "1"
-STAGING_LIBDIR[unexport] = "1"
-
 BBCLASSEXTEND = "native nativesdk"
 
 ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"
-- 
2.29.2


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

* [dunfell 5/5] gpgme: use python3targetconfig
  2020-12-01 16:26 [dunfell 1/5] python3: split python target configuration into own class ernstp
                   ` (2 preceding siblings ...)
  2020-12-01 16:26 ` [dunfell 4/5] meta: drop _PYTHON_SYSCONFIGDATA_NAME hacks Ernst Sjöstrand
@ 2020-12-01 16:26 ` Ernst Sjöstrand
  2020-12-01 16:31 ` [bitbake-devel] [dunfell 1/5] python3: split python target configuration into own class Martin Jansa
       [not found] ` <164CA4BB733E4CEA.8361@lists.openembedded.org>
  5 siblings, 0 replies; 9+ messages in thread
From: Ernst Sjöstrand @ 2020-12-01 16:26 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin, Richard Purdie

From: Alexander Kanavin <alex.kanavin@gmail.com>

(From OE-Core rev: 38ecb83c444406b5157712d87aef3bbb320b45ec)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit de2a5404d3ef1a5dda7c5bb66c5a338883e249e6)
---
 meta/recipes-support/gpgme/gpgme_1.13.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-support/gpgme/gpgme_1.13.1.bb b/meta/recipes-support/gpgme/gpgme_1.13.1.bb
index b51534351d..6e945d3165 100644
--- a/meta/recipes-support/gpgme/gpgme_1.13.1.bb
+++ b/meta/recipes-support/gpgme/gpgme_1.13.1.bb
@@ -49,7 +49,7 @@ DEFAULT_LANGUAGES_class-target = "cpp"
 LANGUAGES ?= "${DEFAULT_LANGUAGES} python"
 
 PYTHON_INHERIT = "${@bb.utils.contains('PACKAGECONFIG', 'python2', 'pythonnative', '', d)}"
-PYTHON_INHERIT .= "${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native', '', d)}"
+PYTHON_INHERIT .= "${@bb.utils.contains('PACKAGECONFIG', 'python3', 'python3native python3targetconfig', '', d)}"
 
 EXTRA_OECONF += '--enable-languages="${LANGUAGES}" \
                  --disable-gpgconf-test \
-- 
2.29.2


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

* Re: [bitbake-devel] [dunfell 1/5] python3: split python target configuration into own class
  2020-12-01 16:26 [dunfell 1/5] python3: split python target configuration into own class ernstp
                   ` (3 preceding siblings ...)
  2020-12-01 16:26 ` [dunfell 5/5] gpgme: use python3targetconfig Ernst Sjöstrand
@ 2020-12-01 16:31 ` Martin Jansa
       [not found] ` <164CA4BB733E4CEA.8361@lists.openembedded.org>
  5 siblings, 0 replies; 9+ messages in thread
From: Martin Jansa @ 2020-12-01 16:31 UTC (permalink / raw)
  To: Ernst Sjöstrand; +Cc: bitbake-devel, Alexander Kanavin, Richard Purdie

[-- Attachment #1: Type: text/plain, Size: 3040 bytes --]

Not sure if this is worth backport (it's very useful, but requires changes
in other layers - and these changes aren't backwards compatible so they
would need to be applied only in dunfell and not gatesgarth branches of
these layers or the same patchset would need to land in oe-core/gatesgarth
first).

But you're definitely missing this fix from master:
https://git.openembedded.org/openembedded-core/commit/?id=c99bb79087e74a967286469e1d8888a546ebec83

On Tue, Dec 1, 2020 at 5:27 PM Ernst Sjöstrand <ernstp@gmail.com> wrote:

> From: Alexander Kanavin <alex.kanavin@gmail.com>
>
> Setting _PYTHON_SYSCONFIGDATA_NAME in python3native class globally was
> problematic as it was leaking into host python environment, which
> was causing tracebacks depending on host distro and action
> (typically anything involving importing sysconfig module).
>
> The new class sets the variable only in specific tasks where it is needed,
> and should be inherited explicitly:
> - use python3native to run scripts with native python
> - use python3targetconfig to run scripts with native python
> if those scripts need to access target config data (such
> as correct installation directories). This also adds a dependency
> on target python, so should be used carefully to avoid lengthening builds.
>
> (From OE-Core rev: 5a118d4e7985fa88f04c3611f8db813f0dafce75)
>
> Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> (cherry picked from commit c9f7ed88a946078c27fa1a62d54d6310fad9d37a)
> ---
>  meta/classes/python3native.bbclass       |  2 --
>  meta/classes/python3targetconfig.bbclass | 15 +++++++++++++++
>  2 files changed, 15 insertions(+), 2 deletions(-)
>  create mode 100644 meta/classes/python3targetconfig.bbclass
>
> diff --git a/meta/classes/python3native.bbclass
> b/meta/classes/python3native.bbclass
> index d98fb4c758..2e3a88c126 100644
> --- a/meta/classes/python3native.bbclass
> +++ b/meta/classes/python3native.bbclass
> @@ -17,8 +17,6 @@ export STAGING_LIBDIR
>  export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
>  export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
>
> -export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
> -
>  # suppress host user's site-packages dirs.
>  export PYTHONNOUSERSITE = "1"
>
> diff --git a/meta/classes/python3targetconfig.bbclass
> b/meta/classes/python3targetconfig.bbclass
> new file mode 100644
> index 0000000000..640d0c97b6
> --- /dev/null
> +++ b/meta/classes/python3targetconfig.bbclass
> @@ -0,0 +1,15 @@
> +inherit python3native
> +
> +DEPENDS_append = " python3"
> +
> +do_configure_prepend() {
> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
> +}
> +
> +do_compile_prepend() {
> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
> +}
> +
> +do_install_prepend() {
> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
> +}
> --
> 2.29.2
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 3921 bytes --]

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

* Re: [bitbake-devel] [dunfell 1/5] python3: split python target configuration into own class
       [not found] ` <164CA4BB733E4CEA.8361@lists.openembedded.org>
@ 2020-12-01 16:32   ` Martin Jansa
  2020-12-01 16:39     ` Ernst Sjöstrand
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Jansa @ 2020-12-01 16:32 UTC (permalink / raw)
  To: Martin Jansa
  Cc: Ernst Sjöstrand, bitbake-devel, Alexander Kanavin, Richard Purdie

[-- Attachment #1: Type: text/plain, Size: 3350 bytes --]

Also all these e-mails belong to openembedded-core ML not bitbake-devel.

On Tue, Dec 1, 2020 at 5:31 PM Martin Jansa via lists.openembedded.org
<Martin.Jansa=gmail.com@lists.openembedded.org> wrote:

> Not sure if this is worth backport (it's very useful, but requires changes
> in other layers - and these changes aren't backwards compatible so they
> would need to be applied only in dunfell and not gatesgarth branches of
> these layers or the same patchset would need to land in oe-core/gatesgarth
> first).
>
> But you're definitely missing this fix from master:
>
> https://git.openembedded.org/openembedded-core/commit/?id=c99bb79087e74a967286469e1d8888a546ebec83
>
> On Tue, Dec 1, 2020 at 5:27 PM Ernst Sjöstrand <ernstp@gmail.com> wrote:
>
>> From: Alexander Kanavin <alex.kanavin@gmail.com>
>>
>> Setting _PYTHON_SYSCONFIGDATA_NAME in python3native class globally was
>> problematic as it was leaking into host python environment, which
>> was causing tracebacks depending on host distro and action
>> (typically anything involving importing sysconfig module).
>>
>> The new class sets the variable only in specific tasks where it is needed,
>> and should be inherited explicitly:
>> - use python3native to run scripts with native python
>> - use python3targetconfig to run scripts with native python
>> if those scripts need to access target config data (such
>> as correct installation directories). This also adds a dependency
>> on target python, so should be used carefully to avoid lengthening builds.
>>
>> (From OE-Core rev: 5a118d4e7985fa88f04c3611f8db813f0dafce75)
>>
>> Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
>> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>> (cherry picked from commit c9f7ed88a946078c27fa1a62d54d6310fad9d37a)
>> ---
>>  meta/classes/python3native.bbclass       |  2 --
>>  meta/classes/python3targetconfig.bbclass | 15 +++++++++++++++
>>  2 files changed, 15 insertions(+), 2 deletions(-)
>>  create mode 100644 meta/classes/python3targetconfig.bbclass
>>
>> diff --git a/meta/classes/python3native.bbclass
>> b/meta/classes/python3native.bbclass
>> index d98fb4c758..2e3a88c126 100644
>> --- a/meta/classes/python3native.bbclass
>> +++ b/meta/classes/python3native.bbclass
>> @@ -17,8 +17,6 @@ export STAGING_LIBDIR
>>  export
>> PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
>>  export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
>>
>> -export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
>> -
>>  # suppress host user's site-packages dirs.
>>  export PYTHONNOUSERSITE = "1"
>>
>> diff --git a/meta/classes/python3targetconfig.bbclass
>> b/meta/classes/python3targetconfig.bbclass
>> new file mode 100644
>> index 0000000000..640d0c97b6
>> --- /dev/null
>> +++ b/meta/classes/python3targetconfig.bbclass
>> @@ -0,0 +1,15 @@
>> +inherit python3native
>> +
>> +DEPENDS_append = " python3"
>> +
>> +do_configure_prepend() {
>> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
>> +}
>> +
>> +do_compile_prepend() {
>> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
>> +}
>> +
>> +do_install_prepend() {
>> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
>> +}
>> --
>> 2.29.2
>>
>>
>>
>>
>>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 4508 bytes --]

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

* Re: [bitbake-devel] [dunfell 1/5] python3: split python target configuration into own class
  2020-12-01 16:32   ` Martin Jansa
@ 2020-12-01 16:39     ` Ernst Sjöstrand
  0 siblings, 0 replies; 9+ messages in thread
From: Ernst Sjöstrand @ 2020-12-01 16:39 UTC (permalink / raw)
  To: Martin Jansa; +Cc: bitbake-devel, Alexander Kanavin, Richard Purdie

[-- Attachment #1: Type: text/plain, Size: 3943 bytes --]

Yeah I was preparing for both lists and got it mixed up. :-) There's
another patch that goes to the bitbake list.
(bitbake: lib/bb/fetch2/__init__.py: drop _PYTHON_SYSCONFIGDATA_NAME
unsetting)

Ah the patch you mentioned is a bit newer than my initial local backport.

The reason for the backport is that many of the initial reports were for
Dunfell, and that Dunfell will be LTS.

Regards
//Ernst

Den tis 1 dec. 2020 kl 17:32 skrev Martin Jansa <martin.jansa@gmail.com>:

> Also all these e-mails belong to openembedded-core ML not bitbake-devel.
>
> On Tue, Dec 1, 2020 at 5:31 PM Martin Jansa via lists.openembedded.org
> <Martin.Jansa=gmail.com@lists.openembedded.org> wrote:
>
>> Not sure if this is worth backport (it's very useful, but requires
>> changes in other layers - and these changes aren't backwards compatible so
>> they would need to be applied only in dunfell and not gatesgarth branches
>> of these layers or the same patchset would need to land in
>> oe-core/gatesgarth first).
>>
>> But you're definitely missing this fix from master:
>>
>> https://git.openembedded.org/openembedded-core/commit/?id=c99bb79087e74a967286469e1d8888a546ebec83
>>
>> On Tue, Dec 1, 2020 at 5:27 PM Ernst Sjöstrand <ernstp@gmail.com> wrote:
>>
>>> From: Alexander Kanavin <alex.kanavin@gmail.com>
>>>
>>> Setting _PYTHON_SYSCONFIGDATA_NAME in python3native class globally was
>>> problematic as it was leaking into host python environment, which
>>> was causing tracebacks depending on host distro and action
>>> (typically anything involving importing sysconfig module).
>>>
>>> The new class sets the variable only in specific tasks where it is
>>> needed,
>>> and should be inherited explicitly:
>>> - use python3native to run scripts with native python
>>> - use python3targetconfig to run scripts with native python
>>> if those scripts need to access target config data (such
>>> as correct installation directories). This also adds a dependency
>>> on target python, so should be used carefully to avoid lengthening
>>> builds.
>>>
>>> (From OE-Core rev: 5a118d4e7985fa88f04c3611f8db813f0dafce75)
>>>
>>> Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
>>> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>>> (cherry picked from commit c9f7ed88a946078c27fa1a62d54d6310fad9d37a)
>>> ---
>>>  meta/classes/python3native.bbclass       |  2 --
>>>  meta/classes/python3targetconfig.bbclass | 15 +++++++++++++++
>>>  2 files changed, 15 insertions(+), 2 deletions(-)
>>>  create mode 100644 meta/classes/python3targetconfig.bbclass
>>>
>>> diff --git a/meta/classes/python3native.bbclass
>>> b/meta/classes/python3native.bbclass
>>> index d98fb4c758..2e3a88c126 100644
>>> --- a/meta/classes/python3native.bbclass
>>> +++ b/meta/classes/python3native.bbclass
>>> @@ -17,8 +17,6 @@ export STAGING_LIBDIR
>>>  export
>>> PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
>>>  export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
>>>
>>> -export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
>>> -
>>>  # suppress host user's site-packages dirs.
>>>  export PYTHONNOUSERSITE = "1"
>>>
>>> diff --git a/meta/classes/python3targetconfig.bbclass
>>> b/meta/classes/python3targetconfig.bbclass
>>> new file mode 100644
>>> index 0000000000..640d0c97b6
>>> --- /dev/null
>>> +++ b/meta/classes/python3targetconfig.bbclass
>>> @@ -0,0 +1,15 @@
>>> +inherit python3native
>>> +
>>> +DEPENDS_append = " python3"
>>> +
>>> +do_configure_prepend() {
>>> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
>>> +}
>>> +
>>> +do_compile_prepend() {
>>> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
>>> +}
>>> +
>>> +do_install_prepend() {
>>> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
>>> +}
>>> --
>>> 2.29.2
>>>
>>>
>>>
>>>
>>>
>> 
>>
>>

[-- Attachment #2: Type: text/html, Size: 6109 bytes --]

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

* Re: [bitbake-devel] [dunfell 1/5] python3: split python target configuration into own class
       [not found] <164CA47CCEEF7F59.8361@lists.openembedded.org>
@ 2020-12-01 16:32 ` Ernst Sjöstrand
  0 siblings, 0 replies; 9+ messages in thread
From: Ernst Sjöstrand @ 2020-12-01 16:32 UTC (permalink / raw)
  To: Ernst Sjöstrand; +Cc: bitbake-devel, Alexander Kanavin, Richard Purdie

[-- Attachment #1: Type: text/plain, Size: 2670 bytes --]

Doh, wrong list! Sorry for the spam.
//E

Den tis 1 dec. 2020 kl 17:27 skrev Ernst Sjöstrand via
lists.openembedded.org <ernstp=gmail.com@lists.openembedded.org>:

> From: Alexander Kanavin <alex.kanavin@gmail.com>
>
> Setting _PYTHON_SYSCONFIGDATA_NAME in python3native class globally was
> problematic as it was leaking into host python environment, which
> was causing tracebacks depending on host distro and action
> (typically anything involving importing sysconfig module).
>
> The new class sets the variable only in specific tasks where it is needed,
> and should be inherited explicitly:
> - use python3native to run scripts with native python
> - use python3targetconfig to run scripts with native python
> if those scripts need to access target config data (such
> as correct installation directories). This also adds a dependency
> on target python, so should be used carefully to avoid lengthening builds.
>
> (From OE-Core rev: 5a118d4e7985fa88f04c3611f8db813f0dafce75)
>
> Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> (cherry picked from commit c9f7ed88a946078c27fa1a62d54d6310fad9d37a)
> ---
>  meta/classes/python3native.bbclass       |  2 --
>  meta/classes/python3targetconfig.bbclass | 15 +++++++++++++++
>  2 files changed, 15 insertions(+), 2 deletions(-)
>  create mode 100644 meta/classes/python3targetconfig.bbclass
>
> diff --git a/meta/classes/python3native.bbclass
> b/meta/classes/python3native.bbclass
> index d98fb4c758..2e3a88c126 100644
> --- a/meta/classes/python3native.bbclass
> +++ b/meta/classes/python3native.bbclass
> @@ -17,8 +17,6 @@ export STAGING_LIBDIR
>  export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
>  export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
>
> -export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
> -
>  # suppress host user's site-packages dirs.
>  export PYTHONNOUSERSITE = "1"
>
> diff --git a/meta/classes/python3targetconfig.bbclass
> b/meta/classes/python3targetconfig.bbclass
> new file mode 100644
> index 0000000000..640d0c97b6
> --- /dev/null
> +++ b/meta/classes/python3targetconfig.bbclass
> @@ -0,0 +1,15 @@
> +inherit python3native
> +
> +DEPENDS_append = " python3"
> +
> +do_configure_prepend() {
> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
> +}
> +
> +do_compile_prepend() {
> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
> +}
> +
> +do_install_prepend() {
> +        export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
> +}
> --
> 2.29.2
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 3616 bytes --]

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

end of thread, other threads:[~2020-12-01 16:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01 16:26 [dunfell 1/5] python3: split python target configuration into own class ernstp
2020-12-01 16:26 ` [dunfell 2/5] python3-pycairo: use python3targetconfig Ernst Sjöstrand
2020-12-01 16:26 ` [dunfell 3/5] distutils3-base.bbclass: " Ernst Sjöstrand
2020-12-01 16:26 ` [dunfell 4/5] meta: drop _PYTHON_SYSCONFIGDATA_NAME hacks Ernst Sjöstrand
2020-12-01 16:26 ` [dunfell 5/5] gpgme: use python3targetconfig Ernst Sjöstrand
2020-12-01 16:31 ` [bitbake-devel] [dunfell 1/5] python3: split python target configuration into own class Martin Jansa
     [not found] ` <164CA4BB733E4CEA.8361@lists.openembedded.org>
2020-12-01 16:32   ` Martin Jansa
2020-12-01 16:39     ` Ernst Sjöstrand
     [not found] <164CA47CCEEF7F59.8361@lists.openembedded.org>
2020-12-01 16:32 ` Ernst Sjöstrand

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.