]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/mac/zappycfiles.py
Fix __repr__
[wxWidgets.git] / wxPython / distrib / mac / zappycfiles.py
CommitLineData
1e4a197e
RD
1#!/usr/local/bin/python
2"""Recursively zap all .pyc and .pyo files"""
3import os
4import sys
5
6# set doit true to actually delete files
7# set doit false to just print what would be deleted
8doit = 1
9
10def main():
11 if not sys.argv[1:]:
12 if os.name == 'mac':
13 import macfs
14 fss, ok = macfs.GetDirectory('Directory to zap pyc files in')
15 if not ok:
16 sys.exit(0)
17 dir = fss.as_pathname()
18 zappyc(dir)
19 else:
20 print 'Usage: zappyc dir ...'
21 sys.exit(1)
22 for dir in sys.argv[1:]:
23 zappyc(dir)
24
25def zappyc(dir):
26 os.path.walk(dir, walker, None)
27
28def walker(dummy, top, names):
29 for name in names:
30 if name[-4:] in ('.pyc', '.pyo'):
31 path = os.path.join(top, name)
32 print 'Zapping', path
33 if doit:
34 os.unlink(path)
35
36if __name__ == '__main__':
37 main()
38