Skip to contentSkip to conversation

distutils.bbclass: Handle python-backport modules

PATCH Superseded Alejandro Hernandez 2 participants 2 messages Sep 3, 2015 – Sep 4, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 distutils.bbclass: Handle python-backport modules

When installing backport modules they stumble upon each other, complaining with the following error:

ERROR: The recipe python-backports-ssl is trying to install files into a shared area when those files already exist.

This is the correct behavior since thats just the way they were designed, all backport modules provide an __init__.py file (the same among all packages), and without it they simply wouldnt work.

distutils handles FILES_${PN}* variables for python packages, but it uses wildcards to include the required files, hence removing the __init__.py files from each backport package during build time is impossible since it doenst actually contain that value, this patch simply removes the __init__.py* files from the staging area if they already exist on sysroot, this way, these are not included in FILES_${PN} anymore, fixing the issue mentioned above.

[YOCTO #8207]

---
 meta/classes/distutils.bbclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
meta/classes/distutils.bbclass +7 -1
index 2498685..82f93d8 100644
@@ -44,7 +44,6 @@ distutils_do_install() {
         # support filenames with *spaces*
         # only modify file if it contains path  and recompile it
         find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \; -exec ${STAGING_BINDIR_NATIVE}/python-native/python -mcompileall {} \;
-
         if test -e ${D}${bindir} ; then	
             for i in ${D}${bindir}/* ; do \
                 if [ ${PN} != "${BPN}-native" ]; then
@@ -73,6 +72,13 @@ distutils_do_install() {
             mv -f ${D}${datadir}/share/* ${D}${datadir}/
             rmdir ${D}${datadir}/share
         fi
+	
+	
+	if [ -e ${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/backports/__init__.py ]; then
+	rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py;
+	rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.pyc;
+	#FILES_${PN}_remove = "${PYTHON_SITEPACKAGES_DIR}/backports/__init__.pyc";
+	fi
 }
 
 EXPORT_FUNCTIONS do_compile do_install
Signature · 1 line
1.8.4.5
#1 lore raw
Quoted 11 lines · Alejandro Hernandez
meta/classes/distutils.bbclass +3 -0
+
+
+       if [ -e

${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/backports/__init__.py ]; then

meta/classes/distutils.bbclass +3 -0
+       rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.py;
+       rm ${D}${PYTHON_SITEPACKAGES_DIR}/backports/__init__.pyc;
+       #FILES_${PN}_remove =

"${PYTHON_SITEPACKAGES_DIR}/backports/__init__.pyc";
+ fi
}

Two blank lines with whitespace at the beginning, bad indentation in the body, and surely the commented out FILES_ can be removed.

Ross