Titus Brown wrote:
Hi again,

I'm developing a C++ library & associated extension module within the
same directory.  My setup.py contains this line:

parser_mod = Extension("paircomp._paircomp_parser",
                       ["c++-ext/_paircomp_parser.cc",],
                       include_dirs=['../lib',],
                       library_dirs=['../lib',],
                       libraries=['paircomp', 'stdc++'])

One of the important libraries that I need to include is -lpaircomp,
in '../lib/libpaircomp.a'.

Currently when I change libpaircomp.a (by, for example, making some
internal change to the C++ library that's not reflected in the API)
my Python extensions do not get recompiled by 'python setup.py build'.
(This is run automatically by the Makefile.)

distutils doesn't do dependency tracking like make.

So at the moment I either have to use Makefile trickery or just do an
'rm -fr build' to force recompilation of the extension when the library
is changed.

Is there a canonical way to tell distutils that 'this extension depends
on this file, so force rebuild if the file changes'?

No.

One obvious possibility would be to simple compare last-changed dates
on all of the libraries with last-changed dates on the .so file
produced by setup.py.

distutils is a tool for packaging code, not a replacement for development tools like make. You normally only run distutils setup.py scripts after you've completed developing your code.

make is a much better tool for dependency checking, so the
"right" way to handle the dependency problem is to add
proper targets to the Makefile.

--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 10 2005)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
_______________________________________________
Distutils-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to