Build tool for Python
mattheww at chiark.greenend.org.uk
Tue Jul 29 22:40:00 CEST 2008
Paul Boddie <paul at boddie.org.uk> wrote:
> I do understand that it can be awkward to work out which object files
> need recompiling due to changes in source files, for example, and
> that one doesn't want to see the logic involved reproduced all over
> the place, but I do wonder whether the machinery around such matters
> isn't sometimes more complicated in these tools as soon as one strays
> outside the common cases.
I think it often is. Tools like 'make' give you little declarative
languages, and when things get a little bit complicated you end up
wasting time working out how to fool it into doing what you want, when
if only you could have direct access to its internals you could quite
happily tell it explicitly.
> It seems to me that some common build-related primitives implemented
> as functions combined with plain Python would be a good enough
> combination for a lot of tasks in this domain.
I agree entirely; I've found this works well.
I think there are three basic building blocks:
- a way to invoke a compiler with suitable options (with some
convenience support for describing project-wide default options and
overriding them where appropriate);
- a way to decide whether a file needs rebuilding (by comparing
timestamps or stored hashes or whatever);
- some kind of topological sort engine to work out what order to build
More information about the Python-list