[yocto] Pre-compiling Python Byte Code

Jussi Kukkonen jussi.kukkonen at intel.com
Fri May 5 00:35:42 PDT 2017


On 3 May 2017 at 21:50, Chris Trobridge <christrobridge at hotmail.com> wrote:
> 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

Looks fine to me. I believe distutils/setuptools would do this for you
though.

Jussi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170505/8e0cfd1b/attachment.html>


More information about the yocto mailing list