[yocto] Pre-compiling Python Byte Code

Chris Trobridge christrobridge at hotmail.com
Wed May 3 11:50:22 PDT 2017


To improve startup speed I have decided to pre-compile python3 byte code in my bb recipe.  This is done semi automatically with the rpm build for Fedora but I've not found anything similar for Yocto.


I initially tried to use compileall:


python3 -m compileall ${D}/opt/test_app/python


This almost worked but it uses the host python3 to failed with a slight difference in magic.


The following works, as it uses the native python3 compiled by bitbake but it feels a little contrived.  Is there a better way of specifying the native python3 interpreter, or a better way of getting my python byte code compiled prior to generating the packages?


${STAGING_BINDIR_NATIVE}/python3-native/python3 -m compileall ${D}/opt/test_app/python

Cheers,

Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170503/475cd549/attachment.html>


More information about the yocto mailing list