diff mbox series

[2/2] python[3]native: allow use of both native Python 2 and 3

Message ID 20180731170541.13620-2-ross.burton@intel.com
State Accepted
Commit 96ccdadb8473daa3c9c2e1cb42fbdff1edd270d6
Headers show
Series [1/2] meson: don't dump full error log on failure | expand

Commit Message

Ross Burton July 31, 2018, 5:05 p.m. UTC
Instead of both classes using ${PYTHON_PN} (which is set by python-dir and
python3-dir), hardcode the right values so that it is possible to inherit both
pythonnative and python3native at the same time.

If both are inherited then both native Pythons are available, but the last to be
inherited will be the one to set PYTHON.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/classes/python3native.bbclass | 6 +++---
 meta/classes/pythonnative.bbclass  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Khem Raj Aug. 2, 2018, 9:05 p.m. UTC | #1
On Tue, Jul 31, 2018 at 10:06 AM Ross Burton <ross.burton@intel.com> wrote:

> Instead of both classes using ${PYTHON_PN} (which is set by python-dir and

> python3-dir), hardcode the right values so that it is possible to inherit

> both

> pythonnative and python3native at the same time.

>

> If both are inherited then both native Pythons are available, but the last

> to be

> inherited will be the one to set PYTHON.



Not particularly thrilled about this usage it seems error prone

>

>

> Signed-off-by: Ross Burton <ross.burton@intel.com>

> ---

>  meta/classes/python3native.bbclass | 6 +++---

>  meta/classes/pythonnative.bbclass  | 6 +++---

>  2 files changed, 6 insertions(+), 6 deletions(-)

>

> diff --git a/meta/classes/python3native.bbclass

> b/meta/classes/python3native.bbclass

> index 89665efee8b..da12a714703 100644

> --- a/meta/classes/python3native.bbclass

> +++ b/meta/classes/python3native.bbclass

> @@ -1,8 +1,8 @@

>  inherit python3-dir

>

> -PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"

> -EXTRANATIVEPATH += "${PYTHON_PN}-native"

> -DEPENDS_append = " ${PYTHON_PN}-native "

> +PYTHON="${STAGING_BINDIR_NATIVE}/python3-native/python3"

> +EXTRANATIVEPATH += "python3-native"

> +DEPENDS_append = " python3-native "

>

>  # python-config and other scripts are using distutils modules

>  # which we patch to access these variables

> diff --git a/meta/classes/pythonnative.bbclass

> b/meta/classes/pythonnative.bbclass

> index 4cc8b2769c2..ae6600cd155 100644

> --- a/meta/classes/pythonnative.bbclass

> +++ b/meta/classes/pythonnative.bbclass

> @@ -1,11 +1,11 @@

>

>  inherit python-dir

>

> -PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"

> +PYTHON="${STAGING_BINDIR_NATIVE}/python-native/python"

>  # PYTHON_EXECUTABLE is used by cmake

>  PYTHON_EXECUTABLE="${PYTHON}"

> -EXTRANATIVEPATH += "${PYTHON_PN}-native"

> -DEPENDS_append = " ${PYTHON_PN}-native "

> +EXTRANATIVEPATH += "python-native"

> +DEPENDS_append = " python-native "

>

>  # python-config and other scripts are using distutils modules

>  # which we patch to access these variables

> --

> 2.11.0

>

> --

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.openembedded.org/mailman/listinfo/openembedded-core

>
<div><br></div><div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jul 31, 2018 at 10:06 AM Ross Burton &lt;<a href="mailto:ross.burton@intel.com">ross.burton@intel.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Instead of both classes using ${PYTHON_PN} (which is set by python-dir and<br>
python3-dir), hardcode the right values so that it is possible to inherit both<br>
pythonnative and python3native at the same time.<br>
<br>
If both are inherited then both native Pythons are available, but the last to be<br>
inherited will be the one to set PYTHON.</blockquote><div dir="auto"><br></div><div dir="auto">Not particularly thrilled about this usage it seems error prone</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Signed-off-by: Ross Burton &lt;<a href="mailto:ross.burton@intel.com" target="_blank">ross.burton@intel.com</a>&gt;<br>

---<br>
 meta/classes/python3native.bbclass | 6 +++---<br>
 meta/classes/pythonnative.bbclass  | 6 +++---<br>
 2 files changed, 6 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass<br>
index 89665efee8b..da12a714703 100644<br>
--- a/meta/classes/python3native.bbclass<br>
+++ b/meta/classes/python3native.bbclass<br>
@@ -1,8 +1,8 @@<br>
 inherit python3-dir<br>
<br>
-PYTHON=&quot;${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}&quot;<br>
-EXTRANATIVEPATH += &quot;${PYTHON_PN}-native&quot;<br>
-DEPENDS_append = &quot; ${PYTHON_PN}-native &quot;<br>
+PYTHON=&quot;${STAGING_BINDIR_NATIVE}/python3-native/python3&quot;<br>
+EXTRANATIVEPATH += &quot;python3-native&quot;<br>
+DEPENDS_append = &quot; python3-native &quot;<br>
<br>
 # python-config and other scripts are using distutils modules<br>
 # which we patch to access these variables<br>
diff --git a/meta/classes/pythonnative.bbclass b/meta/classes/pythonnative.bbclass<br>
index 4cc8b2769c2..ae6600cd155 100644<br>
--- a/meta/classes/pythonnative.bbclass<br>
+++ b/meta/classes/pythonnative.bbclass<br>
@@ -1,11 +1,11 @@<br>
<br>
 inherit python-dir<br>
<br>
-PYTHON=&quot;${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}&quot;<br>
+PYTHON=&quot;${STAGING_BINDIR_NATIVE}/python-native/python&quot;<br>
 # PYTHON_EXECUTABLE is used by cmake<br>
 PYTHON_EXECUTABLE=&quot;${PYTHON}&quot;<br>
-EXTRANATIVEPATH += &quot;${PYTHON_PN}-native&quot;<br>
-DEPENDS_append = &quot; ${PYTHON_PN}-native &quot;<br>
+EXTRANATIVEPATH += &quot;python-native&quot;<br>
+DEPENDS_append = &quot; python-native &quot;<br>
<br>
 # python-config and other scripts are using distutils modules<br>
 # which we patch to access these variables<br>
-- <br>
2.11.0<br>
<br>
-- <br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div></div>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Ross Burton Aug. 2, 2018, 10:50 p.m. UTC | #2
The last to be inherited behaviour?  That's the same as the current
behaviour, apart from after my change both pythons are available via
PATH.

The only change is that inheriting the second class doesn't wipe out
the first class.

Ross

On 2 August 2018 at 22:05, Khem Raj <raj.khem@gmail.com> wrote:
>

>

> On Tue, Jul 31, 2018 at 10:06 AM Ross Burton <ross.burton@intel.com> wrote:

>>

>> Instead of both classes using ${PYTHON_PN} (which is set by python-dir and

>> python3-dir), hardcode the right values so that it is possible to inherit

>> both

>> pythonnative and python3native at the same time.

>>

>> If both are inherited then both native Pythons are available, but the last

>> to be

>> inherited will be the one to set PYTHON.

>

>

> Not particularly thrilled about this usage it seems error prone

>>

>>

>>

>> Signed-off-by: Ross Burton <ross.burton@intel.com>

>> ---

>>  meta/classes/python3native.bbclass | 6 +++---

>>  meta/classes/pythonnative.bbclass  | 6 +++---

>>  2 files changed, 6 insertions(+), 6 deletions(-)

>>

>> diff --git a/meta/classes/python3native.bbclass

>> b/meta/classes/python3native.bbclass

>> index 89665efee8b..da12a714703 100644

>> --- a/meta/classes/python3native.bbclass

>> +++ b/meta/classes/python3native.bbclass

>> @@ -1,8 +1,8 @@

>>  inherit python3-dir

>>

>> -PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"

>> -EXTRANATIVEPATH += "${PYTHON_PN}-native"

>> -DEPENDS_append = " ${PYTHON_PN}-native "

>> +PYTHON="${STAGING_BINDIR_NATIVE}/python3-native/python3"

>> +EXTRANATIVEPATH += "python3-native"

>> +DEPENDS_append = " python3-native "

>>

>>  # python-config and other scripts are using distutils modules

>>  # which we patch to access these variables

>> diff --git a/meta/classes/pythonnative.bbclass

>> b/meta/classes/pythonnative.bbclass

>> index 4cc8b2769c2..ae6600cd155 100644

>> --- a/meta/classes/pythonnative.bbclass

>> +++ b/meta/classes/pythonnative.bbclass

>> @@ -1,11 +1,11 @@

>>

>>  inherit python-dir

>>

>> -PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"

>> +PYTHON="${STAGING_BINDIR_NATIVE}/python-native/python"

>>  # PYTHON_EXECUTABLE is used by cmake

>>  PYTHON_EXECUTABLE="${PYTHON}"

>> -EXTRANATIVEPATH += "${PYTHON_PN}-native"

>> -DEPENDS_append = " ${PYTHON_PN}-native "

>> +EXTRANATIVEPATH += "python-native"

>> +DEPENDS_append = " python-native "

>>

>>  # python-config and other scripts are using distutils modules

>>  # which we patch to access these variables

>> --

>> 2.11.0

>>

>> --

>> _______________________________________________

>> Openembedded-core mailing list

>> Openembedded-core@lists.openembedded.org

>> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Khem Raj Aug. 3, 2018, 3:24 a.m. UTC | #3
On Thu, Aug 2, 2018 at 3:50 PM Burton, Ross <ross.burton@intel.com> wrote:

> The last to be inherited behaviour?  That's the same as the current

> behaviour, apart from after my change both pythons are available via

> PATH.

>

> The only change is that inheriting the second class doesn't wipe out

> the first class.



Ok may be then this variable should be made overridable so a recipe can
select it to be one of two otherwise the default remains as you said

>

>

> Ross

>

> On 2 August 2018 at 22:05, Khem Raj <raj.khem@gmail.com> wrote:

> >

> >

> > On Tue, Jul 31, 2018 at 10:06 AM Ross Burton <ross.burton@intel.com>

> wrote:

> >>

> >> Instead of both classes using ${PYTHON_PN} (which is set by python-dir

> and

> >> python3-dir), hardcode the right values so that it is possible to

> inherit

> >> both

> >> pythonnative and python3native at the same time.

> >>

> >> If both are inherited then both native Pythons are available, but the

> last

> >> to be

> >> inherited will be the one to set PYTHON.

> >

> >

> > Not particularly thrilled about this usage it seems error prone

> >>

> >>

> >>

> >> Signed-off-by: Ross Burton <ross.burton@intel.com>

> >> ---

> >>  meta/classes/python3native.bbclass | 6 +++---

> >>  meta/classes/pythonnative.bbclass  | 6 +++---

> >>  2 files changed, 6 insertions(+), 6 deletions(-)

> >>

> >> diff --git a/meta/classes/python3native.bbclass

> >> b/meta/classes/python3native.bbclass

> >> index 89665efee8b..da12a714703 100644

> >> --- a/meta/classes/python3native.bbclass

> >> +++ b/meta/classes/python3native.bbclass

> >> @@ -1,8 +1,8 @@

> >>  inherit python3-dir

> >>

> >> -PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"

> >> -EXTRANATIVEPATH += "${PYTHON_PN}-native"

> >> -DEPENDS_append = " ${PYTHON_PN}-native "

> >> +PYTHON="${STAGING_BINDIR_NATIVE}/python3-native/python3"

> >> +EXTRANATIVEPATH += "python3-native"

> >> +DEPENDS_append = " python3-native "

> >>

> >>  # python-config and other scripts are using distutils modules

> >>  # which we patch to access these variables

> >> diff --git a/meta/classes/pythonnative.bbclass

> >> b/meta/classes/pythonnative.bbclass

> >> index 4cc8b2769c2..ae6600cd155 100644

> >> --- a/meta/classes/pythonnative.bbclass

> >> +++ b/meta/classes/pythonnative.bbclass

> >> @@ -1,11 +1,11 @@

> >>

> >>  inherit python-dir

> >>

> >> -PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"

> >> +PYTHON="${STAGING_BINDIR_NATIVE}/python-native/python"

> >>  # PYTHON_EXECUTABLE is used by cmake

> >>  PYTHON_EXECUTABLE="${PYTHON}"

> >> -EXTRANATIVEPATH += "${PYTHON_PN}-native"

> >> -DEPENDS_append = " ${PYTHON_PN}-native "

> >> +EXTRANATIVEPATH += "python-native"

> >> +DEPENDS_append = " python-native "

> >>

> >>  # python-config and other scripts are using distutils modules

> >>  # which we patch to access these variables

> >> --

> >> 2.11.0

> >>

> >> --

> >> _______________________________________________

> >> Openembedded-core mailing list

> >> Openembedded-core@lists.openembedded.org

> >> http://lists.openembedded.org/mailman/listinfo/openembedded-core

>
<div><br></div><div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 2, 2018 at 3:50 PM Burton, Ross &lt;<a href="mailto:ross.burton@intel.com">ross.burton@intel.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The last to be inherited behaviour?  That&#39;s the same as the current<br>
behaviour, apart from after my change both pythons are available via<br>
PATH.<br>
<br>
The only change is that inheriting the second class doesn&#39;t wipe out<br>
the first class.</blockquote><div dir="auto"><br></div><div dir="auto">Ok may be then this variable should be made overridable so a recipe can select it to be one of two otherwise the default remains as you said </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Ross<br>
<br>
On 2 August 2018 at 22:05, Khem Raj &lt;<a href="mailto:raj.khem@gmail.com" target="_blank">raj.khem@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Jul 31, 2018 at 10:06 AM Ross Burton &lt;<a href="mailto:ross.burton@intel.com" target="_blank">ross.burton@intel.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Instead of both classes using ${PYTHON_PN} (which is set by python-dir and<br>
&gt;&gt; python3-dir), hardcode the right values so that it is possible to inherit<br>
&gt;&gt; both<br>
&gt;&gt; pythonnative and python3native at the same time.<br>
&gt;&gt;<br>
&gt;&gt; If both are inherited then both native Pythons are available, but the last<br>
&gt;&gt; to be<br>
&gt;&gt; inherited will be the one to set PYTHON.<br>
&gt;<br>
&gt;<br>
&gt; Not particularly thrilled about this usage it seems error prone<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Signed-off-by: Ross Burton &lt;<a href="mailto:ross.burton@intel.com" target="_blank">ross.burton@intel.com</a>&gt;<br>
&gt;&gt; ---<br>
&gt;&gt;  meta/classes/python3native.bbclass | 6 +++---<br>
&gt;&gt;  meta/classes/pythonnative.bbclass  | 6 +++---<br>
&gt;&gt;  2 files changed, 6 insertions(+), 6 deletions(-)<br>
&gt;&gt;<br>
&gt;&gt; diff --git a/meta/classes/python3native.bbclass<br>
&gt;&gt; b/meta/classes/python3native.bbclass<br>
&gt;&gt; index 89665efee8b..da12a714703 100644<br>
&gt;&gt; --- a/meta/classes/python3native.bbclass<br>
&gt;&gt; +++ b/meta/classes/python3native.bbclass<br>
&gt;&gt; @@ -1,8 +1,8 @@<br>
&gt;&gt;  inherit python3-dir<br>
&gt;&gt;<br>
&gt;&gt; -PYTHON=&quot;${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}&quot;<br>
&gt;&gt; -EXTRANATIVEPATH += &quot;${PYTHON_PN}-native&quot;<br>
&gt;&gt; -DEPENDS_append = &quot; ${PYTHON_PN}-native &quot;<br>
&gt;&gt; +PYTHON=&quot;${STAGING_BINDIR_NATIVE}/python3-native/python3&quot;<br>
&gt;&gt; +EXTRANATIVEPATH += &quot;python3-native&quot;<br>
&gt;&gt; +DEPENDS_append = &quot; python3-native &quot;<br>
&gt;&gt;<br>
&gt;&gt;  # python-config and other scripts are using distutils modules<br>
&gt;&gt;  # which we patch to access these variables<br>
&gt;&gt; diff --git a/meta/classes/pythonnative.bbclass<br>
&gt;&gt; b/meta/classes/pythonnative.bbclass<br>
&gt;&gt; index 4cc8b2769c2..ae6600cd155 100644<br>
&gt;&gt; --- a/meta/classes/pythonnative.bbclass<br>
&gt;&gt; +++ b/meta/classes/pythonnative.bbclass<br>
&gt;&gt; @@ -1,11 +1,11 @@<br>
&gt;&gt;<br>
&gt;&gt;  inherit python-dir<br>
&gt;&gt;<br>
&gt;&gt; -PYTHON=&quot;${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}&quot;<br>
&gt;&gt; +PYTHON=&quot;${STAGING_BINDIR_NATIVE}/python-native/python&quot;<br>
&gt;&gt;  # PYTHON_EXECUTABLE is used by cmake<br>
&gt;&gt;  PYTHON_EXECUTABLE=&quot;${PYTHON}&quot;<br>
&gt;&gt; -EXTRANATIVEPATH += &quot;${PYTHON_PN}-native&quot;<br>
&gt;&gt; -DEPENDS_append = &quot; ${PYTHON_PN}-native &quot;<br>
&gt;&gt; +EXTRANATIVEPATH += &quot;python-native&quot;<br>
&gt;&gt; +DEPENDS_append = &quot; python-native &quot;<br>
&gt;&gt;<br>
&gt;&gt;  # python-config and other scripts are using distutils modules<br>
&gt;&gt;  # which we patch to access these variables<br>
&gt;&gt; --<br>
&gt;&gt; 2.11.0<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Openembedded-core mailing list<br>
&gt;&gt; <a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
&gt;&gt; <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div></div>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass
index 89665efee8b..da12a714703 100644
--- a/meta/classes/python3native.bbclass
+++ b/meta/classes/python3native.bbclass
@@ -1,8 +1,8 @@ 
 inherit python3-dir
 
-PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"
-EXTRANATIVEPATH += "${PYTHON_PN}-native"
-DEPENDS_append = " ${PYTHON_PN}-native "
+PYTHON="${STAGING_BINDIR_NATIVE}/python3-native/python3"
+EXTRANATIVEPATH += "python3-native"
+DEPENDS_append = " python3-native "
 
 # python-config and other scripts are using distutils modules
 # which we patch to access these variables
diff --git a/meta/classes/pythonnative.bbclass b/meta/classes/pythonnative.bbclass
index 4cc8b2769c2..ae6600cd155 100644
--- a/meta/classes/pythonnative.bbclass
+++ b/meta/classes/pythonnative.bbclass
@@ -1,11 +1,11 @@ 
 
 inherit python-dir
 
-PYTHON="${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN}"
+PYTHON="${STAGING_BINDIR_NATIVE}/python-native/python"
 # PYTHON_EXECUTABLE is used by cmake
 PYTHON_EXECUTABLE="${PYTHON}"
-EXTRANATIVEPATH += "${PYTHON_PN}-native"
-DEPENDS_append = " ${PYTHON_PN}-native "
+EXTRANATIVEPATH += "python-native"
+DEPENDS_append = " python-native "
 
 # python-config and other scripts are using distutils modules
 # which we patch to access these variables