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