[Zope-Checkins] CVS: Zope/lib/python/Zope/Startup - decompilezpy.py:1.1

Chris McDonough chrism@zope.com
Sun, 6 Jul 2003 18:43:59 -0400


Update of /cvs-repository/Zope/lib/python/Zope/Startup
In directory cvs.zope.org:/tmp/cvs-serv15428/lib/python/Zope/Startup

Added Files:
	decompilezpy.py 
Log Message:
Add utility which removes all *.pyc and *.pyo files (used by Windows installer during uninstall).


=== Added File Zope/lib/python/Zope/Startup/decompilezpy.py ===
import os
import sys

def main(dirname):
    os.path.walk(dirname, rmpycs, None)

def rmpycs(arg, dirname, names):
    for name in names:
        path = os.path.join(dirname, name)
        if ( name.endswith('.pyc') or name.endswith('.pyo') and
             os.path.isfile(path) ):
            os.unlink(path)

if __name__ == '__main__':
    main(sys.argv[1])