* (No subject)
@ 2012-12-06 9:49 Lukas Bulwahn
2012-12-06 9:49 ` [PATCH] distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup Lukas Bulwahn
0 siblings, 1 reply; 6+ messages in thread
From: Lukas Bulwahn @ 2012-12-06 9:49 UTC (permalink / raw)
To: openembedded-core
I was trying to create a minimal core image with python-setuptools and noticed that the python-setuptools recipe does not work.
The reason is that during do_install, it creates shell scripts that refer to python-native instead of python.
The attached patch tries to solve this issue. Another minimal example thta shows this issue can be found at https://gist.github.com/4223250.
Lukas Bulwahn
BMW Car IT GmbH
From Lukas Bulwahn <lukas.bulwahn@oss.bmw-carit.de> # This line is ignored.
From: Lukas Bulwahn <lukas.bulwahn@oss.bmw-carit.de>
Subject:
In-Reply-To:
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup
2012-12-06 9:49 (No subject) Lukas Bulwahn
@ 2012-12-06 9:49 ` Lukas Bulwahn
2012-12-06 9:54 ` Lukas Bulwahn
2012-12-10 23:18 ` Saul Wold
0 siblings, 2 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2012-12-06 9:49 UTC (permalink / raw)
To: openembedded-core; +Cc: Lukas Bulwahn, Lukas Bulwahn
From: Lukas Bulwahn <lukas.bulwahn@bmw-carit.de>
When using distutils for a python package based on a python-setuptools
installation script that sets up a console script, the header
of the console script created by setuptools points to the
python-native path.
The console scripts are commonly executed in the image, but not
in the sysroot environment. Therefore, the header of the
console scripts should point to the python interpreter in the
image.
Setuptools does not allow to set the path of the python
interpreter via some command-line argument.
Hence after the installation script ran, the distutils
class replaces the path in the console script files created by
the installation.
Signed-off-by: Lukas Bulwahn <Lukas.Bulwahn@oss.bmw-carit.de>
---
meta/classes/distutils.bbclass | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass
index 552e5f3..f67297e 100644
--- a/meta/classes/distutils.bbclass
+++ b/meta/classes/distutils.bbclass
@@ -47,12 +47,14 @@ distutils_do_install() {
if test -e ${D}${bindir} ; then
for i in ${D}${bindir}/* ; do \
+ sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${bindir}/python:g $i
sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
done
fi
if test -e ${D}${sbindir}; then
for i in ${D}${sbindir}/* ; do \
+ sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${bindir}/python:g $i
sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
done
fi
@@ -64,7 +66,6 @@ distutils_do_install() {
#
if test -e ${D}${datadir}/share; then
mv -f ${D}${datadir}/share/* ${D}${datadir}/
- rmdir ${D}${datadir}/share
fi
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup
2012-12-06 9:49 ` [PATCH] distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup Lukas Bulwahn
@ 2012-12-06 9:54 ` Lukas Bulwahn
2012-12-10 23:18 ` Saul Wold
1 sibling, 0 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2012-12-06 9:54 UTC (permalink / raw)
To: openembedded-core
Hi all,
I was trying to create a minimal core image with python-setuptools and
noticed that the python-setuptools recipe does not work.
The reason is that during do_install, it creates shell scripts that
refer to python-native instead of python.
The patch tries to solve this issue. Another minimal example that shows
this issue can be found at https://gist.github.com/4223250.
Lukas Bulwahn
BMW Car IT GmbH
P.S. Sorry, my git-send-email did not send this cover-letter.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup
2012-12-06 9:49 ` [PATCH] distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup Lukas Bulwahn
2012-12-06 9:54 ` Lukas Bulwahn
@ 2012-12-10 23:18 ` Saul Wold
2012-12-13 16:43 ` Lukas Bulwahn
1 sibling, 1 reply; 6+ messages in thread
From: Saul Wold @ 2012-12-10 23:18 UTC (permalink / raw)
To: Lukas Bulwahn; +Cc: Lukas Bulwahn, openembedded-core
On 12/06/2012 01:49 AM, Lukas Bulwahn wrote:
> From: Lukas Bulwahn <lukas.bulwahn@bmw-carit.de>
>
> When using distutils for a python package based on a python-setuptools
> installation script that sets up a console script, the header
> of the console script created by setuptools points to the
> python-native path.
>
> The console scripts are commonly executed in the image, but not
> in the sysroot environment. Therefore, the header of the
> console scripts should point to the python interpreter in the
> image.
>
> Setuptools does not allow to set the path of the python
> interpreter via some command-line argument.
> Hence after the installation script ran, the distutils
> class replaces the path in the console script files created by
> the installation.
>
> Signed-off-by: Lukas Bulwahn <Lukas.Bulwahn@oss.bmw-carit.de>
> ---
> meta/classes/distutils.bbclass | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Thanks for the patch, good catch, but need a slight tweak.
Sau!
> diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass
> index 552e5f3..f67297e 100644
> --- a/meta/classes/distutils.bbclass
> +++ b/meta/classes/distutils.bbclass
> @@ -47,12 +47,14 @@ distutils_do_install() {
>
> if test -e ${D}${bindir} ; then
> for i in ${D}${bindir}/* ; do \
> + sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${bindir}/python:g $i
I think this should really end up being #!/usr/bin/env python as that's
how I see all other scripts do it.
> sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
> done
> fi
>
> if test -e ${D}${sbindir}; then
> for i in ${D}${sbindir}/* ; do \
> + sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${bindir}/python:g $i
Same here.
> sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
> done
> fi
> @@ -64,7 +66,6 @@ distutils_do_install() {
> #
> if test -e ${D}${datadir}/share; then
> mv -f ${D}${datadir}/share/* ${D}${datadir}/
> - rmdir ${D}${datadir}/share
> fi
> }
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup
2012-12-10 23:18 ` Saul Wold
@ 2012-12-13 16:43 ` Lukas Bulwahn
0 siblings, 0 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2012-12-13 16:43 UTC (permalink / raw)
To: Saul Wold; +Cc: Lukas Bulwahn, openembedded-core
On 12/11/2012 12:18 AM, Saul Wold wrote:
> Thanks for the patch, good catch, but need a slight tweak.
>
> Sau!
>
Thanks for the hint. I refined the patch.
Lukas
^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <0C66DAA.8090800@linux.intel.com>]
* [PATCH] distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup
[not found] <0C66DAA.8090800@linux.intel.com>
@ 2012-12-13 16:55 ` Lukas Bulwahn
0 siblings, 0 replies; 6+ messages in thread
From: Lukas Bulwahn @ 2012-12-13 16:55 UTC (permalink / raw)
To: openembedded-core, sgw; +Cc: Lukas Bulwahn, Lukas Bulwahn
From: Lukas Bulwahn <lukas.bulwahn@bmw-carit.de>
When using distutils for a python package based on a python-setuptools
installation script that sets up a console script, the header
of the console script created by setuptools points to the
python-native path.
The console scripts are commonly executed in the image, but not
in the sysroot environment. Therefore, the header of the
console scripts should point to the python interpreter in the
image.
Setuptools does not allow to set the path of the python
interpreter via some command-line argument.
Hence after the installation script ran, the distutils
class replaces the path in the console script files created by
the installation.
Signed-off-by: Lukas Bulwahn <Lukas.Bulwahn@oss.bmw-carit.de>
---
meta/classes/distutils.bbclass | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta/classes/distutils.bbclass b/meta/classes/distutils.bbclass
index 552e5f3..02f5cb6 100644
--- a/meta/classes/distutils.bbclass
+++ b/meta/classes/distutils.bbclass
@@ -47,12 +47,14 @@ distutils_do_install() {
if test -e ${D}${bindir} ; then
for i in ${D}${bindir}/* ; do \
+ sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${bindir}/env python:g $i
sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
done
fi
if test -e ${D}${sbindir}; then
for i in ${D}${sbindir}/* ; do \
+ sed -i -e s:${STAGING_BINDIR_NATIVE}/python-native/python:${bindir}/env python:g $i
sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
done
fi
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-12-13 17:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-06 9:49 (No subject) Lukas Bulwahn
2012-12-06 9:49 ` [PATCH] distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup Lukas Bulwahn
2012-12-06 9:54 ` Lukas Bulwahn
2012-12-10 23:18 ` Saul Wold
2012-12-13 16:43 ` Lukas Bulwahn
[not found] <0C66DAA.8090800@linux.intel.com>
2012-12-13 16:55 ` Lukas Bulwahn
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.