<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 7 January 2015 at 09:23, Mike Looijmans <span dir="ltr"><<a href="mailto:mike.looijmans@topic.nl" target="_blank">mike.looijmans@topic.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":78e" class="" style="overflow:hidden">You definitely SHOULD ship the .pyc files. If they don't exist, the interpreter is forced to re-compile the .py source, and will attempt to write the result to the filesystem. It won't cause harm, it won't fail, but it's very inefficient. It's better to let the host do the py->pyc conversion anyway.<br>
<br>
The opposite works just fine: You can omit the .py files and ship only .pyc files. We do that on settopboxes that use Python for the GUI, this saves several megabytes of flash space.<br>
To accomplish that, we put the .py files into a $PN-src package.</div></blockquote></div><br>I agree with Mike, there is a use-case for just shipping .pyc. Whether oe-core should do something to assist with this or not is debatable.</div><div class="gmail_extra"><br></div><div class="gmail_extra">There's an open bug report about this: <a href="https://bugzilla.yoctoproject.org/show_bug.cgi?id=6434">https://bugzilla.yoctoproject.org/show_bug.cgi?id=6434</a>.</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="https://docs.python.org/2/tutorial/modules.html#compiled-python-files">https://docs.python.org/2/tutorial/modules.html#compiled-python-files</a> has the details we're after. Summary:<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">.pyc is Python bytecode, which is an implementation detail of CPython. As such it's version-dependent but explicitly architecture-independent.</div><div class="gmail_extra">.pyo generated with -O is simply .pyc but with asserts removed.</div><div class="gmail_extra">.pyo generated with -O -O has asserts and docstrings removed.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I think it's fair to say we should just ignore .pyo - no point generating and shipping it. It does seem that if we want to ship usable .pyc we need to ensure that they are compiled with python-native. I guess this could be done by calling python-native's compileall module to recompile the sources at package time.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Ross</div><div class="gmail_extra"><br></div></div>