Staging
v0.5.1
https://github.com/python/cpython
Revision bbc4ef077acf7274519e026f896e04574991ec87 authored by Georg Brandl on 27 April 2009, 16:36:03 UTC, committed by Georg Brandl on 27 April 2009, 16:36:03 UTC
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71957 | georg.brandl | 2009-04-26 08:05:58 +0200 (So, 26 Apr 2009) | 2 lines

  Note that the versions are also in README.txt.
........
  r71959 | georg.brandl | 2009-04-26 08:06:53 +0200 (So, 26 Apr 2009) | 2 lines

  Another file where the versions need to be up to date.
........
  r71961 | georg.brandl | 2009-04-26 11:57:29 +0200 (So, 26 Apr 2009) | 2 lines

  Update pydoc topics.
........
1 parent c9b6089
Raw File
Tip revision: bbc4ef077acf7274519e026f896e04574991ec87 authored by Georg Brandl on 27 April 2009, 16:36:03 UTC
Recorded merge of revisions 71957,71959,71961 via svnmerge from
Tip revision: bbc4ef0
rmpyc.py
# Remove all the .pyc and .pyo files under ../Lib.


def deltree(root):
    import os
    from os.path import join

    npyc = npyo = 0
    for root, dirs, files in os.walk(root):
        for name in files:
            delete = False
            if name.endswith('.pyc'):
                delete = True
                npyc += 1
            elif name.endswith('.pyo'):
                delete = True
                npyo += 1

            if delete:
                os.remove(join(root, name))

    return npyc, npyo

npyc, npyo = deltree("../../Lib")
print npyc, ".pyc deleted,", npyo, ".pyo deleted"
back to top