[Dev] tools/purge.py cleans up obsolete .pyc/.pyo files

Phillip J. Eby pje at telecommunity.com
Tue Aug 2 17:58:58 PDT 2005


To fix the problem of Subversion leaving "orphans" behind when you delete 
or move packages, I've added a tools/purge.py script that removes orphaned 
.pyc and .pyo files.  It only deletes files that have no corresponding .py, 
so that using it will not cause anything to need recompilation.

If after deleting orphaned files from a directory, the directory is found 
to be empty (and is an orphan, no longer under Subversion control), then 
the script will attempt to remove the directory as well.  (Note: It does 
not just remove empty directories in general; it only removes directories 
that it deleted orphan files from.)

Running the script is simple; to purge the Chandler tree, you can just run:

    RunPython tools/purge.py .

from the chandler/ directory.  The script takes a few options; you can use 
--help or -h to list them.

I'm currently in the process of flattening osaf.contentmodel.contacts; when 
I check this work in you'll need to run the purge script against your 
checkout in order to remove the resulting orphans.

Hopefully, someone more familiar with the build process will be able to 
graft this script into the tinderboxes as well.



More information about the Dev mailing list