From 93b03b620a50c37410e513d3058007d7da644233 Mon Sep 17 00:00:00 2001
From: Lukas Bulwahn <lukas.bulwahn@bmw-carit.de>
Date: Mon, 17 Dec 2012 12:01:14 +0100
Subject: [PATCH] experimenting to install the correct easy_install.pth
 automagically

---
 meta/recipes-core/images/core-image-bmw.bb     | 10 ++--------
 .../python/python-rospkg_1.0.15.bb             | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-core/images/core-image-bmw.bb b/meta/recipes-core/images/core-image-bmw.bb
index c85c9ea..16532d4 100644
--- a/meta/recipes-core/images/core-image-bmw.bb
+++ b/meta/recipes-core/images/core-image-bmw.bb
@@ -17,17 +17,11 @@ augment_hosts_setting_file () {
 
 # installs the easy_install_pth_file that we need
 create_python_easy_install_pth_file () {
-	cat > ${IMAGE_ROOTFS}/usr/lib/python2.7/site-packages/easy-install.pth << EOF
-import sys; sys.__plen = len(sys.path)
-./setuptools-0.6c11-py2.7.egg
-./rospkg-1.0.15-py2.7.egg
-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
-
+	:
 }
 
 # remove not needed ipkg informations
 # create a custom hosts file
 ROOTFS_POSTPROCESS_COMMAND += "remove_packaging_data_files ; augment_hosts_setting_file ; create_python_easy_install_pth_file ; "
 
-IMAGE_INSTALL += "boost boost-dev packagegroup-core-ssh-openssh dhcp-client file ldd python-modules python-setuptools python-rospkg python-rosinstall git cmake python-empy python-pyyaml python-nose log4cxx log4cxx-dev libbz2-dev ros"
+IMAGE_INSTALL += "boost boost-dev packagegroup-core-ssh-openssh dhcp-client file ldd python-modules python-setuptools python-rospkg python-rosinstall git cmake python-empy python-pyyaml python-nose log4cxx log4cxx-dev libbz2-dev"
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 476e117..aa57f4b 100644
--- a/meta/recipes-devtools/python/python-rospkg_1.0.15.bb
+++ b/meta/recipes-devtools/python/python-rospkg_1.0.15.bb
@@ -11,3 +11,21 @@ SRC_URI[sha256sum] = "f8be5a9d74f7e656d38b2c3b44b7e367fce4001d613ca3fbfcbb87c493
 S = "${WORKDIR}/${SRCNAME}-${PV}"
 
 inherit distutils
+
+# Must inherit package first before changing PACKAGEFUNCS
+inherit package
+PACKAGEFUNCS += "add_easyinstall_pth"
+
+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
+        fi
+
+}
\ No newline at end of file
-- 
GitLab