[Python-Dev] Help on issue 5941

David Cournapeau cournape at gmail.com
Thu May 7 11:50:18 CEST 2009


On Wed, May 6, 2009 at 6:01 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> Hello,
>
> I need some help on http://bugs.python.org/issue5941
>
> The bug is quite simple: the Distutils unixcompiler used to set the
> archiver command to "ar -rc".
>
> For quite a while now, this behavior has changed in order to be able
> to customize the compiler behavior from
> the environment. That introduced a regression because the mechanism in
> Distutils that looks for the
> AR variable in the environment also looks into the Makefile of Python.
> (in the Makefile then is os.environ)
>
> And as a matter of fact, AR is set to "ar" in there, so the -cr option
> is not set anymore.
>
> So my question is : should I make a change into the Makefile by adding
> for example a variable called AR_OPTIONS
> then build the ar command with AR + AR_OPTIONS

I think for consistency, it could be named ARFLAGS (this is the name
usually taken for configure scripts), and both should be overridable
as the other variable in distutils.sysconfig.customize_compiler. Those
flags should be used in Makefile.pre as well, instead of the harcoded
cr as currently used.

Here is what I would try:
 - check for AR (already done in the configure script AFAICT)
 - if ARFLAGS is defined in the environment, use those, otherwise set
ARFLAGS to cr
 - use ARFLAGS in the makefile

Then, in the customize_compiler function, set archiver to $AR +
$ARFLAGS. IOW, just copying the logic used for e.g. ldshared,

I can prepare a patch if you want,

cheers,

David


More information about the Python-Dev mailing list