This commit was manufactured by cvs2svn to create tag 'r221c2'.
[python/dscho.git] / PCbuild / rmpyc.py
blob019c69b16e79e21818e36f53a7799c75dbb1d8eb
1 # Remove all the .pyc and .pyo files under ../Lib.
3 def deltree(root):
4 import os
5 def rm(path):
6 os.unlink(path)
7 npyc = npyo = 0
8 dirs = [root]
9 while dirs:
10 dir = dirs.pop()
11 for short in os.listdir(dir):
12 full = os.path.join(dir, short)
13 if os.path.isdir(full):
14 dirs.append(full)
15 elif short.endswith(".pyc"):
16 npyc += 1
17 rm(full)
18 elif short.endswith(".pyo"):
19 npyo += 1
20 rm(full)
21 return npyc, npyo
23 npyc, npyo = deltree("../Lib")
24 print npyc, ".pyc deleted,", npyo, ".pyo deleted"