Python Makefiles... are they possible?

Benjamin Schollnick benjamin at
Wed Feb 13 11:45:14 CET 2013

>> One thing we do in our Makefiles is "find . -name '*.pyc' | xargs rm".
>> It avoids all sorts of nasty and hard to track down bugs (consider what
>> happens if you move a .py file from one place in your source tree to
>> another and leave the old .pyc behind).
> How often do you move files around in the source tree? Meanwhile, *every* 
> time you run make, you take a performance hit on every Python module in 
> your project, whether it has moved or not.
> Seems to me like a fairly heavy-handed response for something quite rare, 
> but I suppose that depends on how often you run make.

If the performance hit doesn't really matter.  

Then simply walk the build tree, compare time date stamps, anything that doesn't match up in the make directory, gets deleted.  Anything that has different Date Created / Date Modified time from the build tree match, get's deleted.

This way, we are preserving any files that should be identical.  But there should be some mechanism documented to forcibly clear the build cache.

		- Benjamin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list