python-native: Mangle shebang-invoking scripts
authorTom Rini <tom_rini@mentor.com>
Fri, 28 Jan 2011 22:22:44 +0000 (15:22 -0700)
committerTom Rini <tom_rini@mentor.com>
Fri, 28 Jan 2011 22:22:44 +0000 (15:22 -0700)
Need to make sure python*-config is invokable even in
deep path builds.

Signed-off-by: Tom Rini <tom_rini@mentor.com>
recipes/python/python-native_2.6.5.bb
recipes/python/python-native_2.7.1.bb

index 51a1fb1..0fd6dcb 100644 (file)
@@ -1,6 +1,6 @@
 require python.inc
 DEPENDS = "openssl-native bzip2-full-native zlib-native readline-native sqlite3-native"
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 FILESPATHPKG .= ":python-${PV}:python"
 SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \
@@ -37,4 +37,9 @@ do_install() {
        oe_runmake 'DESTDIR=${D}' install
        install -d ${D}${bindir}/
        install -m 0755 Parser/pgen ${D}${bindir}/
+
+       # Make sure we use /usr/bin/env python
+       for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do
+               sed -i -e '1s|^#!.*|#!/usr/bin/env python|' $PYTHSCRIPT
+       done
 }
index eb487a9..c2a1cec 100644 (file)
@@ -1,6 +1,6 @@
 require python2.7.inc
 DEPENDS = "openssl-native bzip2-full-native zlib-native readline-native sqlite3-native"
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 
 FILESPATHPKG .= ":python-${PV}:python"
 SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.bz2 \
@@ -34,5 +34,10 @@ EXTRA_OEMAKE = '\
 do_install() {
        oe_runmake 'DESTDIR=${D}' install
        install -d ${D}${bindir}/
+
+       # Make sure we use /usr/bin/env python
+       for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do
+               sed -i -e '1s|^#!.*|#!/usr/bin/env python|' $PYTHSCRIPT
+       done
        install -m 0755 Parser/pgen ${D}${bindir}/
 }