distutils question

Jorgen Grahn jgrahn-nntq at algonet.se
Fri Sep 9 12:22:48 EDT 2005


On Wed, 07 Sep 2005 10:56:40 -0700, Joachim Dahl <joachim at ee.ucla.edu> wrote:
> I am trying to make a customized install script for an extension module 
> using the distutils.ccompiler class.
>
> I want to embed an existing makefile for the C libraries into the Python 
> setup script, but I am not sure what's the right way to do it...
>
> E.g., say I want to compile a project as:
>
> gcc -Ddef1 -c foo.c -o foo_def1.o
> gcc -Ddef2 -c foo.c -o foo_def2.o
> gcc foo_def1.o foo_def2.o -o myext_module.o
>
> How would I do that using distutils? It doesn't seem to be possible with
> the normal core.setup method, and distutils.ccompiler seems to be the
> best option, but I couldn't get it working...

When I once had to do such an abomination, I started my setup.py with code
which created renamed copies of the master source file (if they didn't
already exist and were newer than the source) and then let normal C
compilation take place,

/Jorgen

[1] For bizarre reasons, I had to import three identical *.pyd modules into
    one Python program under different names, so the *pyd files and their
    init methods had to have distinct names. Don't ask why.

-- 
  // Jorgen Grahn <jgrahn@       Ph'nglui mglw'nafh Cthulhu
\X/                algonet.se>   R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list