On Tue, Sep 22, 2015 at 2:25 PM, Neal Gompa ngompa13@gmail.com wrote:
On Tue, Sep 22, 2015 at 5:36 AM, Matej Stuchlik mstuchli@redhat.com wrote:
Also note that it's possibly not just 9MB. For instance python3-boto, also on this list, would save 4.7MB, python3-pip 2.9MB. In general most python packages could go down in size by ~20-30%.
However, this approach would break with Python 3.5 (where pyo data is merged into *.pyc data)
To be more precise, AFAIU there's no "merging", *.pyo goes away but in exchange there are actually two new optimized bytecode files, *.opt-1.pyc and *.opt-2.pyc: https://www.python.org/dev/peps/pep-0488/ If you want to exclude them from packages, they should be there listed as %ghost so they're removed in case they get generated by something run with -O or -OO. Ditto *.pyo if you intend to exclude them from python < 3.5 packages.
Also, be careful with measuring space savings when working with *.pyo. It is a common case that *.pyc and *.pyo are identical, and when they are rpmbuild already hardlinks them.