From: "Ville Skyttä" <ville.skytta(a)iki.fi>
To: "Development discussions related to Fedora"
Sent: Tuesday, September 22, 2015 1:36:09 PM
Subject: Re: Fedora 23 cloud image (and, for that matter, minimal anything) bloat
On Tue, Sep 22, 2015 at 2:25 PM, Neal Gompa <ngompa13(a)gmail.com> wrote:
> On Tue, Sep 22, 2015 at 5:36 AM, Matej Stuchlik <mstuchli(a)redhat.com>
>> 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
> 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.
That's really interesting, I've had no idea:
% find /usr/ -name "*.pyc" | wc -l
# All .pyc files
% find /usr/ -name "*.pyc" -links +1 | wc -l
# .pyc files that are hard linked
find /usr/ -name '*.pyc' -links 1 -print0 | du --files0-from=- -ch | tail -n1
# Total size of non-hardlinked .pyc files
If I'm correct here it looks like it wouldn't really be worth it.