[Python-checkins] CVS: python/dist/src/PCbuild rmpyc.py,NONE,1.1 rt.bat,1.5,1.6

Tim Peters tim_one@users.sourceforge.net
Sat, 10 Feb 2001 16:46:41 -0800


Update of /cvsroot/python/python/dist/src/PCbuild
In directory usw-pr-cvs1:/tmp/cvs-serv2147/python/dist/src/PCbuild

Modified Files:
	rt.bat 
Added Files:
	rmpyc.py 
Log Message:
Change Windows test to do a complete job of removing .pyc/.pyo files
reachable from Lib/.


--- NEW FILE: 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"

Index: rt.bat
===================================================================
RCS file: /cvsroot/python/python/dist/src/PCbuild/rt.bat,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** rt.bat	2001/01/23 02:42:09	1.5
--- rt.bat	2001/02/11 00:46:39	1.6
***************
*** 22,29 ****
  @if "%_qmode%"=="yes" goto Qmode
  @echo Deleting .pyc/.pyo files ...
! @del ..\Lib\*.pyc
! @del ..\Lib\*.pyo
! @del ..\Lib\test\*.pyc
! @del ..\Lib\test\*.pyo
  %_exe% %_dashO% ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9
  @echo About to run again without deleting .pyc/.pyo first:
--- 22,26 ----
  @if "%_qmode%"=="yes" goto Qmode
  @echo Deleting .pyc/.pyo files ...
! @%_exe% rmpyc.py
  %_exe% %_dashO% ../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9
  @echo About to run again without deleting .pyc/.pyo first: