Patchwork [v2,1/2] python-distribute: add nativesdk to BBCLASSEXTEND

login
register
mail settings
Submitter João Henrique Freitas
Date July 14, 2014, 10:55 p.m.
Message ID <1405378518-4832-2-git-send-email-joaohf@gmail.com>
Download mbox | patch
Permalink /patch/75481/
State Accepted
Commit f07c17dcee56c8c020b965bf62d81209a6d2eca4
Headers show

Comments

João Henrique Freitas - July 14, 2014, 10:55 p.m.
Without this, python tools that need python-distribute doesn't install
in SDK generated by OE.

Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
---
 meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Otavio Salvador - July 15, 2014, 1:35 p.m.
On Mon, Jul 14, 2014 at 7:55 PM, João Henrique Ferreira de Freitas
<joaohf@gmail.com> wrote:
> Without this, python tools that need python-distribute doesn't install
> in SDK generated by OE.
>
> Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
> ---
>  meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/python/python-distribute_0.6.32.bb b/meta/recipes-devtools/python/python-distribute_0.6.32.bb
> index 58bb8b4..7000145 100644
> --- a/meta/recipes-devtools/python/python-distribute_0.6.32.bb
> +++ b/meta/recipes-devtools/python/python-distribute_0.6.32.bb
> @@ -39,6 +39,12 @@ do_install_append() {
>      echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth
>  }
>
> +do_install_append_class-nativesdk() {
> +       sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py
> +       sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install
> +       sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install-${PYTHON_BASEVERSION}
> +}

Couldn't this be done unconditionally for all target types?
"/usr/bin/env python" should work fine in target as well, no?
João Henrique Freitas - July 17, 2014, 12:50 a.m.
Hi Otavio,

Em 15-07-2014 10:35, Otavio Salvador escreveu:
> On Mon, Jul 14, 2014 at 7:55 PM, João Henrique Ferreira de Freitas
> <joaohf@gmail.com> wrote:
>> Without this, python tools that need python-distribute doesn't install
>> in SDK generated by OE.
>>
>> Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
>> ---
>>   meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/recipes-devtools/python/python-distribute_0.6.32.bb b/meta/recipes-devtools/python/python-distribute_0.6.32.bb
>> index 58bb8b4..7000145 100644
>> --- a/meta/recipes-devtools/python/python-distribute_0.6.32.bb
>> +++ b/meta/recipes-devtools/python/python-distribute_0.6.32.bb
>> @@ -39,6 +39,12 @@ do_install_append() {
>>       echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth
>>   }
>>
>> +do_install_append_class-nativesdk() {
>> +       sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py
>> +       sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install
>> +       sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install-${PYTHON_BASEVERSION}
>> +}
> Couldn't this be done unconditionally for all target types?
> "/usr/bin/env python" should work fine in target as well, no?
>
I don't know if I fully understood your question...


Do you mean by 'all target types' like native, nativesdk ?

In some recipes (gnome-doc-utils.inc, createrepo_0.4.11.bb) , this 
pattern was used:

----
# Wrap the python script since the native python is
# ${bindir}/python-native/python, and the "#! /usr/bin/env python" can't
# find it since it is not in PATH.
do_install_append_class-native () {
  ...
   sed -i -e 's|^#!.*/usr/bin/env python|#! /usr/bin/env nativepython|' $i
  ...
}
----

Sometimes I feel really lost when need to fixes things like that. What 
is the correct way?

Without do_install_append_class-nativesdk() I got:

Computing transaction...error: Can't install nativesdk-python-distribute-0.6.32-ml5@x86_64_nativesdk: no package provides /usr/bin/python


Thanks.
Otavio Salvador - July 17, 2014, 11:33 a.m.
On Wed, Jul 16, 2014 at 9:50 PM, João Henrique Ferreira de Freitas
<joaohf@gmail.com> wrote:
> Em 15-07-2014 10:35, Otavio Salvador escreveu:
>> On Mon, Jul 14, 2014 at 7:55 PM, João Henrique Ferreira de Freitas
>> <joaohf@gmail.com> wrote:
>>>
>>> Without this, python tools that need python-distribute doesn't install
>>> in SDK generated by OE.
>>>
>>> Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
>>> ---
>>>   meta/recipes-devtools/python/python-distribute_0.6.32.bb | 8 +++++++-
>>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/meta/recipes-devtools/python/python-distribute_0.6.32.bb
>>> b/meta/recipes-devtools/python/python-distribute_0.6.32.bb
>>> index 58bb8b4..7000145 100644
>>> --- a/meta/recipes-devtools/python/python-distribute_0.6.32.bb
>>> +++ b/meta/recipes-devtools/python/python-distribute_0.6.32.bb
>>> @@ -39,6 +39,12 @@ do_install_append() {
>>>       echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" >
>>> ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth
>>>   }
>>>
>>> +do_install_append_class-nativesdk() {
>>> +       sed -i -e '1s|^#!.*|#!/usr/bin/env python|'
>>> ${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py
>>> +       sed -i -e '1s|^#!.*|#!/usr/bin/env python|'
>>> ${D}${bindir}/easy_install
>>> +       sed -i -e '1s|^#!.*|#!/usr/bin/env python|'
>>> ${D}${bindir}/easy_install-${PYTHON_BASEVERSION}
>>> +}
>>
>> Couldn't this be done unconditionally for all target types?
>> "/usr/bin/env python" should work fine in target as well, no?
>>
> I don't know if I fully understood your question...
>
>
> Do you mean by 'all target types' like native, nativesdk ?

Yes. To do it in do_install_append and change it for all targets ...

> In some recipes (gnome-doc-utils.inc, createrepo_0.4.11.bb) , this pattern
> was used:
>
> ----
> # Wrap the python script since the native python is
> # ${bindir}/python-native/python, and the "#! /usr/bin/env python" can't
> # find it since it is not in PATH.
> do_install_append_class-native () {
>  ...
>   sed -i -e 's|^#!.*/usr/bin/env python|#! /usr/bin/env nativepython|' $i
>  ...
> }
> ----
>
> Sometimes I feel really lost when need to fixes things like that. What is
> the correct way?

I think the above answer my question, it need to be nativepython for
native so it indeed must to be different.

> Without do_install_append_class-nativesdk() I got:
>
> Computing transaction...error: Can't install
> nativesdk-python-distribute-0.6.32-ml5@x86_64_nativesdk: no package provides
> /usr/bin/python

Your fix is fine than. Sorry for the noise :-)

Patch

diff --git a/meta/recipes-devtools/python/python-distribute_0.6.32.bb b/meta/recipes-devtools/python/python-distribute_0.6.32.bb
index 58bb8b4..7000145 100644
--- a/meta/recipes-devtools/python/python-distribute_0.6.32.bb
+++ b/meta/recipes-devtools/python/python-distribute_0.6.32.bb
@@ -39,6 +39,12 @@  do_install_append() {
     echo "./${SRCNAME}-${PV}-py${PYTHON_BASEVERSION}.egg" > ${D}${PYTHON_SITEPACKAGES_DIR}/setuptools.pth
 }
 
+do_install_append_class-nativesdk() {
+	sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${PYTHON_SITEPACKAGES_DIR}/distribute-${PV}-py${PYTHON_BASEVERSION}.egg/setuptools/tests/test_resources.py
+	sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install
+	sed -i -e '1s|^#!.*|#!/usr/bin/env python|' ${D}${bindir}/easy_install-${PYTHON_BASEVERSION}
+}
+
 RDEPENDS_${PN} = "\
   python-distutils \
   python-compression \
@@ -46,4 +52,4 @@  RDEPENDS_${PN} = "\
 
 RPROVIDES_${PN} += "python-setuptools"
 
-BBCLASSEXTEND = "native"
+BBCLASSEXTEND = "native nativesdk"