Skip to contentSkip to conversation

distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup

PATCH New Lukas Bulwahn 1 participant 1 message Dec 13, 2012 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 distutils: Replacing path to native python by path to python in the image to support python packages with console-script setup

In reply to a message not in the archive

From: Lukas Bulwahn <[email protected]>

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.

---
 meta/classes/distutils.bbclass |    2 ++
 1 file changed, 2 insertions(+)
meta/classes/distutils.bbclass +2 -0
index 552e5f3..02f5cb6 100644
@@ -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
Signature · 1 line
1.7.9.5