[Zope-Checkins] CVS: Zope/utilities - testrunner.py:1.24.44.1

Jeremy Hylton jeremy@zope.com
Fri, 10 May 2002 16:26:49 -0400


Update of /cvs-repository/Zope/utilities
In directory cvs.zope.org:/tmp/cvs-serv14309/utilities

Modified Files:
      Tag: TestIndexDS9-branch
	testrunner.py 
Log Message:
Commit recent changes from the Zope trunk.

Of particular interest: setup.py! (works with Python 2.3)



=== Zope/utilities/testrunner.py 1.24 => 1.24.44.1 ===
         os.chdir(working_dir)
 
+def remove_stale_bytecode(arg, dirname, names):
+    names = map(os.path.normcase, names)
+    for name in names:
+        if name.endswith(".pyc") or name.endswith(".pyo"):
+            srcname = name[:-1]
+            if srcname not in names:
+                fullname = os.path.join(dirname, name)
+                print "Removing stale bytecode file", fullname
+                os.unlink(fullname)
 
 def main(args):
 
@@ -304,6 +313,8 @@
             sys.stderr = f
         else:
             err_exit(usage_msg)
+
+    os.path.walk(os.curdir, remove_stale_bytecode, None)
 
     testrunner = TestRunner( os.getcwd()
                            , verbosity=verbosity