diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-02-11 00:46:39 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-02-11 00:46:39 (GMT) |
commit | 6a9aec47b72cf42bed0f845e751eb243f85b43d6 (patch) | |
tree | ede35da316bad5cf967b2e32717c37aac98868cc | |
parent | d2c1abe5ed138784301cc035ed420754ca8cd0a7 (diff) | |
download | cpython-6a9aec47b72cf42bed0f845e751eb243f85b43d6.zip cpython-6a9aec47b72cf42bed0f845e751eb243f85b43d6.tar.gz cpython-6a9aec47b72cf42bed0f845e751eb243f85b43d6.tar.bz2 |
Change Windows test to do a complete job of removing .pyc/.pyo files
reachable from Lib/.
-rw-r--r-- | PCbuild/rmpyc.py | 24 | ||||
-rwxr-xr-x | PCbuild/rt.bat | 5 |
2 files changed, 25 insertions, 4 deletions
diff --git a/PCbuild/rmpyc.py b/PCbuild/rmpyc.py new file mode 100644 index 0000000..019c69b --- /dev/null +++ b/PCbuild/rmpyc.py @@ -0,0 +1,24 @@ +# 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" diff --git a/PCbuild/rt.bat b/PCbuild/rt.bat index 4a4c97e..1d2829f 100755 --- a/PCbuild/rt.bat +++ b/PCbuild/rt.bat @@ -21,10 +21,7 @@ @if "%1"=="-d" goto Again @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% 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: @pause |