[Pythonmac-SIG] customize distutils universal extension build?
woklist at kyngchaos.com
Thu May 18 16:11:21 CEST 2006
On May 18, 2006, at 2:14 AM, Ronald Oussoren wrote:
> On 18-mei-2006, at 5:29, William Kyngesburye wrote:
>> Is there some way to customize or override the build flags for
>> building a Python extension (a C library wrapper)?
>> My main problem is that it adds the -g debug flag, ballooning the
>> size of the module. I want to build WITHOUT the -g flag.
> It is possible to add additonal flags, but that won't help you
> because you want to remove an existing flag and that is not
> possible. GCC also doesn't have a flag that negates the -g flag.
> If you want to remove the debugging information you can use the
> strip command to remove this from the compiled extension.
I've had mostly bad luck with stripping libraries - it would
sometimes create an unstable or broken library. I'd prefer not using
-g in the first place.
Is there maybe a python config file with the flags that distutils
uses? I looked around a bit in the framework but didn't see
anything. Or is that built into the python binary/library?
> But, why do care about the size of the compiled extension? Disk
> space is cheap these days ;-).
Disk space is cheap, but not always download bandwidth. I build and
package this for others.
And I'm a frugal person and like things compact, with little bloat.
One library I've built was a difference of 20MB with debug or 2MB
optimized (and that's one of those where I had problems stripping
it). An application (in constant development) was something like
150MB or 35MB. Add to that the doubling affect of universal builds
> Furthermore, if you redistribute the extension as part of an
> applicationt that is build using py2app the extension will be
> stripped when it is stuffed inside the application bundle.
It's not really meant for application use, but as a part of using
Python for web serving. Another reason for being small - less to
load, and reload..., into memory for the webserver.
Tho that's an interesting possibility - I've seen a question about
that on the software's mailing list before.
William Kyngesburye <kyngchaos at kyngchaos.com>
"Time is an illusion - lunchtime doubly so."
- Ford Prefect
More information about the Pythonmac-SIG