[Zope-Checkins] CVS: Zope3 - stupid_build.py:1.1.2.6
Guido van Rossum
guido@python.org
Thu, 28 Mar 2002 20:31:33 -0500
Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv21763
Modified Files:
Tag: Zope-3x-branch
stupid_build.py
Log Message:
Before running setup.py, remove all stale .pyc and .pyo files.
Hopefully this will prevent future generations the kind of
embarrasment that befell Casey Duncan tonight: he removed various
files that were still in use, but didn't notice (probably) because the
.pyc files were still there.
=== Zope3/stupid_build.py 1.1.2.5 => 1.1.2.6 ===
import sys, os
+def remove_stale_bytecode(arg, dirname, names):
+ for name in names:
+ name = os.path.normcase(name)
+ 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 visit(setup_dirs, dirname, names):
+ remove_stale_bytecode(None, dirname, names)
if 'setup.py' in names:
setup_dirs.append(dirname)