automatically generating file dependency information from python tools

Moosebumps moosebumps at moosebumps.com
Fri Apr 9 18:16:39 EDT 2004


Say you have a group of 20 programmers, and they're all writing python
scripts that are simple data crunchers -- i.e. command line tools that read
from one or more files and output one or more files.

I want to set up some sort of system that would automatically generate
makefile type information from the source code of these tools.  Can anyone
think of a good way of doing it?  You could make everyone call a special
function that wraps the file() and detects whether they are opening the file
for read or write.  If read, it's an input, if write, it's an output file
(assume there is no r/w access).  Then I guess your special function would
output the info in some sort of repository, which collects such info from
all the individual data crunchers.

The other thing I could think of is statically analyzing the source code -- 
but what if the filenames are generated dynamically?  I'd be interested in
any ideas or links on this, I just started thinking about it today.  For
some reason it seems to be a sort of problem to solve with metaclasses -- 
but I haven't thought of exactly how.

thanks,
MB





More information about the Python-list mailing list