[Toybox] request for comments: pybloat.py
Elie De Brauwer
eliedebrauwer at gmail.com
Wed Feb 15 04:37:02 PST 2012
On 02/15/2012 01:28 PM, Rob Landley wrote:
> On 02/15/2012 12:11 AM, Elie De Brauwer wrote:
>> Hello all,
>>
>> Since Rob mentioned earlier he wanted to replace the GPL parts of the
>> bulid process by non-GPL counterparts, one of them being the bloat-o-meter.
>> In attachment you find a bloat-o-meter replacement called pybloat, not
>> in the form of a patch, but rather in the form of something to play
>> with/shoot at, hence comments are welcome.
>>
>> Whilst the bloat-o-meter is a wrapper around nm --sort-size filtering
>> out symbols from the BSS, data and text section and uses readelf to
>> obtain the .rodata size. This first version bases itself fully on the
>> output of nm (which will show explicit deltas in the .ro section instead
>> of just .rodata).
>>
>> I give this some quick tests on toybox itself and so far it seems to
>> behave.
>>
>> But feedback/wisdom/comments are welcomed.
>
> Very nice.
>
> I had vaguely planned to rewrite this as a shell script. Python's a
> nice language, but the main build only needs shell and C, and having
> extra dependencies (and requiring developers working on the project to
> know _three_ languages to bang on all of it) seems unnecessary overhead.
>
> That said, this is a debug script: entirely optional and not a build
> dependency per se. And the existing one was already in Python...
>
> I definitely want to remove scripts/config2help.py and am halfway done
> with a C implementation of that already. (Which may also form the basis
> for a non-gpl rewrite of menuconfig, not sure yet. On the menuconfig
> side, the need for ncurses as part of the build is another "ouch"
> moment. For a while there the kernel required ncurses for "make
> defconfig" and I had to chop that out, but I complained and they fixed
> it upstream.)
>
> I've actually been shipping the allyesconfig generated/help.h so people
> can build on systems that haven't got python installed. (I've natively
> built and installed python in my aboriginal linux system images before,
> the gentoo-bootstrap build control image actually does that, but if
> you're trying to bootstrap a microblaze or hexagon or something that's
> never run Linux before needing to get python working before the system
> can rebuild itself natively is crazy.)
>
> I originally wrote that in python because merging the help text of a
> command with multiple options (especially merging the "usage:" strings)
> was just too fiddly for shell scripts... and then I never got around to
> implementing that. :) Redoing it in C now...
>
>> Only requirement is python 2.7 since it's using argparse instead of
>> optparse.
>
> Yeah, about that:
>
> Traceback (most recent call last):
> File "scripts/pybloat.py", line 13, in<module>
> import argparse
> ImportError: No module named argparse
> make: *** [bloatcheck] Error 1
>
> How would I install argparse on Ubuntu 10.04 LTS? It doesn't seem to be
> there by default. (Python 2.6.5 apparently.)
>
Jikes, apparently there is no installation candidate for python2.7, I'll
modify the code to use optarg instead of argparse, python2.7 isn't as
widespread as i thought it was. I'll get a new version for testing out.
(I considered writing it in sh or C, but the fact that python natively
supports set operations was the reason to keep in in .py).
gr
E.
--
Elie De Brauwer
More information about the Toybox
mailing list