distutils, C extensions, Borland compiler, wxPython

Anders J. Munch andersjm at dancontrol.dk
Tue Feb 5 09:07:32 EST 2002


Hi,

I have built Python from source on Win2K using cygwin except with a
Borland compiler (BCB4) instead of gcc.  It took a fair amount of
hacks to get the configure script and makefiles to work (s/.o/.obj/ is
just the beginning) but it was worth it.

It's all statically linked.  I kinda like monolithic executables, so
rather than get .dlls to work I have just disabled that part of the
makefile.

It works great.  I've been extending and embedding like crazy for a
while, using Setup.local.

There's just one hitch: distutils.  I'd like to use wxPython, but
wxPython uses distutils with C extensions.

"python setup.py install" fails, unsurprisingly, because it doesn't
know how to build and import the C++ code.  I wonder if the
configure/make process is supposed to store this information
somewhere, but even if it did, it probably wouldn't work.  I presume
distutils relies on the use of .dll/.so's which I'd rather not have to
mess with, and also my python.exe is not a cygwin app. and hence
doesn't understand the cygwin paths from the make process.

Now what I'd like to have is for distutils to just tell me which
.c/.c++ files need to be compiled into python and with which options,
so that I could add these files to Setup.local manually and rebuild
python.exe.

The distutils docs I have seen so far don't seem to get beyond
"press the big green button and everything works automatically".  Are
there any docs on how to tell distutils which compiler to use and how?

TIA for any advice.

the-docs-state-that-"Windows-Python-is-built-in-Microsoft-Visual-C++"-
which-is-of-course-perfectly-true-(except-when-it-isn't)-ly y'rs, 
 Anders


PS: The wxPython setup.py error message that I get:
! Traceback (most recent call last):
!   File "setup.py", line 10, in ?
!     from my_distutils import run_swig, contrib_copy_tree
! File "my_distutils.py", line 125, in ?
!  ccompiler.default_compiler['nt'] = 'my_msvc'
! AttributeError: 'module' object has no attribute 'default_compiler'





More information about the Python-list mailing list