Staging
v0.5.1
https://github.com/python/cpython
Revision 6c5786fb12da06115b76122d5d2c25f9a6c0a052 authored by Tarek Ziadé on 07 February 2009, 00:11:50 UTC, committed by Tarek Ziadé on 07 February 2009, 00:11:50 UTC
................
  r69387 | tarek.ziade | 2009-02-07 01:10:48 +0100 (Sat, 07 Feb 2009) | 9 lines

  Merged revisions 69385 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r69385 | tarek.ziade | 2009-02-07 01:05:39 +0100 (Sat, 07 Feb 2009) | 1 line

    #3986 replacing string and types call (like in the Py3k branch), and put exec_msg call at the right place
  ........
................
1 parent 3d5d4da
Raw File
Tip revision: 6c5786fb12da06115b76122d5d2c25f9a6c0a052 authored by Tarek Ziadé on 07 February 2009, 00:11:50 UTC
Blocked revisions 69387 via svnmerge
Tip revision: 6c5786f
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