[OE-core] [RFC PATCH] package.bbclass: omit .pyc and .pyo file

Robert Yang liezhi.yang at windriver.com
Wed Jan 7 09:32:10 UTC 2015



On 01/07/2015 05:23 PM, Mike Looijmans wrote:
> On 01/07/2015 09:07 AM, Richard Purdie wrote:
>> On Tue, 2015-01-06 at 17:07 -0800, Robert Yang wrote:
>>> We should not ship .pyc or .pyo file, but there are a few packages
>>> ship .pyc, should we:
>>
>> Why should we not ship them? Doesn't python create these at runtime if
>> they're not present? What happens on a read only filesystem?
>
> 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.

AFAIK, the .pyc is not version compatible, the .pyc created with the
build host's python may not work with the target python.

// Robert

>
> 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.
> To accomplish that, we put the .py files into a $PN-src package.
>
> There has been general agreement that .pyo files are utterly pointless.
>
>> I'm sure we've had issues raised by someone with a read only filesystem
>> before FWIW.
>>
>> I agree there is probably an issue here but deleting them may not be the
>> best option. I'm open to ideas though.
>
> My idea would be to standardize on shipping ONLY compiled files, and put the
> source .py files into a separate package named $PN-src by default. There is no
> need to install megabytes of python source files that neither users nor the
> interpreter will ever read.
>
>
>
> Met vriendelijke groet / kind regards,
>
> Mike Looijmans
> System Expert
>
>
> TOPIC Embedded Systems
> Eindhovenseweg 32-C, NL-5683 KH Best
> Postbus 440, NL-5680 AK Best
> Telefoon: (+31) (0) 499 33 69 79
> Telefax:  (+31) (0) 499 33 69 70
> E-mail: mike.looijmans at topic.nl
> Website: www.topic.nl
>
> Please consider the environment before printing this e-mail
>
> Topic zoekt gedreven (embedded) software specialisten!
> http://topic.nl/vacatures/topic-zoekt-software-engineers/
>



More information about the Openembedded-core mailing list