Merged wxPython 2.4.x to the 2.5 branch (Finally!!!)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
38
wxPython/distrib/mac/zappycfiles.py
Normal file
38
wxPython/distrib/mac/zappycfiles.py
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/local/bin/python
|
||||
"""Recursively zap all .pyc and .pyo files"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
# set doit true to actually delete files
|
||||
# set doit false to just print what would be deleted
|
||||
doit = 1
|
||||
|
||||
def main():
|
||||
if not sys.argv[1:]:
|
||||
if os.name == 'mac':
|
||||
import macfs
|
||||
fss, ok = macfs.GetDirectory('Directory to zap pyc files in')
|
||||
if not ok:
|
||||
sys.exit(0)
|
||||
dir = fss.as_pathname()
|
||||
zappyc(dir)
|
||||
else:
|
||||
print 'Usage: zappyc dir ...'
|
||||
sys.exit(1)
|
||||
for dir in sys.argv[1:]:
|
||||
zappyc(dir)
|
||||
|
||||
def zappyc(dir):
|
||||
os.path.walk(dir, walker, None)
|
||||
|
||||
def walker(dummy, top, names):
|
||||
for name in names:
|
||||
if name[-4:] in ('.pyc', '.pyo'):
|
||||
path = os.path.join(top, name)
|
||||
print 'Zapping', path
|
||||
if doit:
|
||||
os.unlink(path)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Reference in New Issue
Block a user