[OE-core] [PATCH 1/3] distutils3.bbclass: add egg files/directories to python path

Jose Lamego jose.a.lamego at linux.intel.com
Tue Jan 17 15:42:09 UTC 2017


Packages that use .egg files or directories for installation may
not be found when imported at the python3 interpreter.
.egg files/directories path must be included in a .pth file to
be appropriately included in python path.

This change looks for .egg files/directories in sitepackages
and adds its path to a .pth file during package installation.
It ensures that any new package that uses .egg files/recipes
will be appropriately added to path by performing the check from
the distutils3 class.

[YOCTO #8673]

Signed-off-by: Jose Lamego <jose.a.lamego at linux.intel.com>
---
 meta/classes/distutils3.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/classes/distutils3.bbclass b/meta/classes/distutils3.bbclass
index a6720c5..f8e2e2e 100644
--- a/meta/classes/distutils3.bbclass
+++ b/meta/classes/distutils3.bbclass
@@ -68,6 +68,16 @@ distutils3_do_install() {
             mv -f ${D}${datadir}/share/* ${D}${datadir}/
             rmdir ${D}${datadir}/share
         fi
+
+        # detect if .egg files/directories were created and add their
+        # path to a .pth file
+        SHORT_PN=$(echo "${PN}" | sed 's/${PYTHON_PN}-//g')
+        if test -e ${D}${PYTHON_SITEPACKAGES_DIR}/${SHORT_PN}*.egg; then
+            EGG_NAME=$(basename $(find ${D}${PYTHON_SITEPACKAGES_DIR}/ \
+-name ${SHORT_PN}\*.egg))
+            echo "./${EGG_NAME}" > ${D}${PYTHON_SITEPACKAGES_DIR}/\
+${SHORT_PN}.pth
+        fi
 }
 distutils3_do_install[vardepsexclude] = "MACHINE"
 
-- 
1.8.3.1




More information about the Openembedded-core mailing list