Staging
v0.8.1
v0.8.1
Revision 84d6457fe4b92730de50847cb238f942cd04937a authored by Georg Brandl on 05 March 2011, 13:55:23 UTC, committed by Georg Brandl on 05 March 2011, 13:55:23 UTC
1 parent 56b2c92
rmpyc.py
# Remove all the .pyc and .pyo files under ../Lib.
def deltree(root):
import os
def rm(path):
os.unlink(path)
npyc = npyo = 0
dirs = [root]
while dirs:
dir = dirs.pop()
for short in os.listdir(dir):
full = os.path.join(dir, short)
if os.path.isdir(full):
dirs.append(full)
elif short.endswith(".pyc"):
npyc += 1
rm(full)
elif short.endswith(".pyo"):
npyo += 1
rm(full)
return npyc, npyo
npyc, npyo = deltree("../Lib")
print npyc, ".pyc deleted,", npyo, ".pyo deleted"
Computing file changes ...