[Pyrex] New Distutils implementation for Pyrex.

Stefan Behnel stefan_ml at behnel.de
Sat Aug 11 10:32:08 CEST 2007


Hi Greg,

Greg Ewing wrote:
> Stefan Behnel wrote:
>> 3) you want to generate c++ code and do not use any additional C++ source
>> files in the extension. Then you have to pass some option to Pyrex/Cython to
>> make it generate C++ code. I don't see why you can't just stick to the
>> language option in this case
> 
> If you're talking about putting a different value
> in the language option to distinquish between
> an instruction to Pyrex and an instruction about
> the rest of the .c files

No I'm not. In all three cases, I'm talking about putting either "c" or "c++"
into that option, depending on what you want the C compiler to take as input.
That's pretty much what that options is meant for. Also, if every tool that
generated C sources (like Pyrex and SWIG) followed these semantics of
generating C code when the language option said "c" and C++ if it said "c++",
you wouldn't need one option per tool but only the one single "language"
option. Imagine you wanted to generate C++ code from an extension that used
both Swig and Pyrex code. That would require you to set one option for Swig,
one for Pyrex and then either set the "language" option as third option or
rely on distutils to autodetect the generated sources. How much overhead is that?


> what happens if you want to use both at the same time?

Is there a fourth case that I have forgotten? Could you give me an example so
that we can see how to deal with it? I can't really imagine a case where
someone would set one option to "c" and the other to "c++".


> It seems simpler to me to use a separate option,
> because the two things are really orthogonal.

No, they are not. That's the case I'm trying to make by writing down the
different cases that you might come across. Only the third case requires an
option and it can easily be dealt with by reusing the existing option that you
normally wouldn't need to set by hand in that case. So if we provide two
options that would always carry the same value (or be autodetected as the same
value you provided with the other option), what's the point?

Stefan



More information about the Pyrex mailing list