From 443bbf6661ea98a793011966f5b1462adbbab716 Mon Sep 17 00:00:00 2001
From: Lukas Bulwahn <lukas.bulwahn@bmw-carit.de>
Date: Mon, 17 Dec 2012 15:39:20 +0100
Subject: [PATCH] a first iteration at creating the correct easyinstall.pth
 file

---
 .../python/python-rospkg_1.0.15.bb             | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-devtools/python/python-rospkg_1.0.15.bb b/meta/recipes-devtools/python/python-rospkg_1.0.15.bb
index aa57f4b..c722cae 100644
--- a/meta/recipes-devtools/python/python-rospkg_1.0.15.bb
+++ b/meta/recipes-devtools/python/python-rospkg_1.0.15.bb
@@ -20,12 +20,14 @@ add_easyinstall_pth () {
 	echo "rospkg add_easyinstall_pth..."
 }
 
-
-pkg_postinst_python-rospkg () {
-	if test -e ${PYTHON_SITEPACKAGES_DIR}/easy-install.pth; then
-            echo insert >> ${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
-        else
-            echo create >> ${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
+EASYINSTALL_python-rospkg = "rospkg-1.0.15-py2.7.egg"
+
+pkg_postinst_${PN} () {
+	if test ! -e ${PYTHON_SITEPACKAGES_DIR}/easy-install.pth; then
+            cat > ${PYTHON_SITEPACKAGES_DIR}/easy-install.pth << EOF
+import sys; sys.__plen = len(sys.path)
+import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
+EOF
         fi
-
-}
\ No newline at end of file
+        sed -i '$ i ${EASYINSTALL_${PN}}' ${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
+}
-- 
GitLab