[Python-Dev] Pass possibly imcompatible options to distutil's ccompiler

David Cournapeau cournape at gmail.com
Wed Apr 13 05:25:59 CEST 2011


On Tue, Apr 12, 2011 at 8:32 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Tue, Apr 12, 2011 at 7:41 AM, Lukas Lueg <lukas.lueg at googlemail.com> wrote:
>> Any other ideas on how to solve this in a better way?
>
> Have you tried with distutils2? If it can't help you, it should really
> be looked into before the packaging API is locked for 3.3.

distutil2 is almost identical to distutils as far as compilation goes,
so I am not sure why it would help the OP.

@Lukas: if you want to check for compiler flag support, the best way
to do it in distutils is to use the config support: look in particular
in the try_compile/try_link methods. The schema is basically:

# code may refer to e.g. a trivial extension source code
try_compile(code) # check that the current option set is sane
for each additional flag you are interested:
   save compiler option
   add the additional flag
   if try_compile(code) == 0:
       restore compiler option

cheers,

David


More information about the Python-Dev mailing list