All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Looijmans <mike.looijmans@topicproducts.com>
To: "yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: Re: Reducing the size of the image by optimizing python
Date: Mon, 21 Oct 2019 11:50:25 +0000	[thread overview]
Message-ID: <8d915ed2-365b-cfc0-0e18-70798f0347c9@topicproducts.com> (raw)
In-Reply-To: <e6d9c7aa1796070677b20b08999fa2313abde740.camel@linuxfoundation.org>

> Optimising to just pyc files is an optimisation further than most
> people find they need and will be much harder to do.

It's actually quite simple, just add a bbappend to the python recipe that puts 
all .py files into the "dbg" or newly created "src" package. Or simply delete 
all .py files in a do_install_append.


Here's an example of the "src" approach:

https://github.com/OpenPLi/openpli-oe-core/blob/develop/meta-openpli/recipes-devtools/python/python_2.7.13.bbappend


Simply doing this in the bbappend might also work (untested):

do_install_append() {
	find ${D}${libdir}/python${PYTHON_MAJMIN}/ -name '*.py' -remove
}


Removing the ".py" files roughly cuts the disk space in half.


The "src" approach works on any package, and has the advantage that you can 
still install the source files for debugging and development.

Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
Postbus 440, 5680 AK Best
The Netherlands

T: +31 (0) 499 33 69 69
E: {E-mail
W: www.topicproducts.com

Please consider the environment before printing this e-mail

  parent reply	other threads:[~2019-10-21 11:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  7:49 Reducing the size of the image by optimizing python Abhi Arora
2019-10-18  8:58 ` Khem Raj
2019-10-19 12:45   ` Abhi Arora
2019-10-19 14:34     ` Richard Purdie
2019-10-19 14:55       ` Abhi Arora
2019-10-19 15:10         ` richard.purdie
2019-10-19 15:21           ` Yann Dirson
2019-10-19 16:32             ` Abhi Arora
2019-10-20 10:59               ` Josef Holzmayr
2019-10-20 15:29                 ` Abhi Arora
     [not found]           ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.4240ac9c-b01f-45e6-9070-5b2736653819@emailsignatures365.codetwo.com>
     [not found]             ` <1b153bce-a66a-45ee-a5c6-963ea6fb1c82.0d2bd5fa-15cc-4b27-b94e-83614f9e5b38.bf5d2683-0b1e-4651-b4bc-cad3e441cbf0@emailsignatures365.codetwo.com>
2019-10-21 11:50               ` Mike Looijmans [this message]
2019-10-21  9:09     ` Ross Burton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d915ed2-365b-cfc0-0e18-70798f0347c9@topicproducts.com \
    --to=mike.looijmans@topicproducts.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.