[Distutils] (no subject)

Phillip J. Eby pje at telecommunity.com
Fri Nov 4 01:08:00 CET 2005


At 03:46 PM 11/3/2005 -0800, Dethe Elza wrote:
> > But it doesn't properly support C++, or the use of a compiler other
> > than
> > the one that built Python itself.  Those features are absolutely
> > required for VPython.
> >
> > -Jonathan
>
>I'm not a distutils/setuptools expert (though I'm willing and eager
>to become one rather than struggle with autoconf any further), but
>can anyone tell me if Jonathan's statement is even true?
>
>I'm willing to create a parallel setuptools-based builder just for OS
>X use, since the same compiler problem isn't an issue on OS X, but
>can I use distutils with C++ code?

As far as I know, yes.  I don't know what is meant by "properly support 
C++", though.  If the meaning is "support static initializers when Python 
was not built with a C++ compiler and runtime", then that statement might 
be correct, but if that is the issue then no other method of building 
(short of rebuilding the Python executable) would fix the problem anyway, 
and distutils is neither the problem nor the solution in that case.

As for the "use of a compiler other than the one that built Python itself", 
that's not correct either.  For example, it is common to build Python 
extensions for Windows using distutils and the MinGW compiler, even though 
Python itself is built with Visual C++.  Also, it's possible to get the 
distutils to build using the freeware version of Visual C++ as well.

Alas, I am not an OS X or C++ expert, so I'm unlikely to be able to give 
you much guidance, other than pointing you to the distutils docs:

      http://docs.python.org/ext/building.html

As far as I'm aware, it should be sufficient to list the C++ (.cpp) files 
in 'sources', and to specify the various libraries, defines, etc. as shown 
on the page above.  (Creating a useful cross-platform setup.py will of 
course require conditional code to change the libraries, macros, or other 
values as appropriate.)



More information about the Distutils-SIG mailing list