Skip to contentSkip to conversation

distutils: regenerate pyc files after being modified by sed

PATCH New Alejandro Hernandez 1 participant 1 message Jun 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 distutils: regenerate pyc files after being modified by sed

py files are edited by sed and therefore *.pyc files are recreated on first boot, but if you have a read-only filesystem this is not possible. This patch creates pyc files directly after the py files are modified.

[YOCTO #7722]

---
 meta/classes/distutils.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/distutils.bbclass +2 -2
index c0bb573..2498685 100644
@@ -42,8 +42,8 @@ distutils_do_install() {
         bbfatal "${PYTHON_PN} setup.py install execution failed."
 
         # support filenames with *spaces*
-        # only modify file if it contains path to avoid recompilation on the target
-        find ${D} -name "*.py" -exec grep -q ${D} {} \; -exec sed -i -e s:${D}::g {} \;
+        # 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 \
Signature · 1 line
1.8.4.5