[pypy-svn] pypy default: Add a small equivalent to the old py.cleanup.

arigo commits-noreply at bitbucket.org
Sat Mar 12 20:26:55 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r42535:da95ea609720
Date: 2011-03-12 14:26 -0500
http://bitbucket.org/pypy/pypy/changeset/da95ea609720/

Log:	Add a small equivalent to the old py.cleanup.

diff --git a/pypy/tool/py.cleanup b/pypy/tool/py.cleanup
new file mode 100755
--- /dev/null
+++ b/pypy/tool/py.cleanup
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+import py, sys
+
+def shouldremove(p):
+    return p.ext == '.pyc'
+
+count = 0
+
+for arg in sys.argv[1:] or ['.']:
+    path = py.path.local(arg)
+    print "cleaning path", path, "of .pyc files"
+    for x in path.visit(shouldremove, lambda x: x.check(dotfile=0, link=0)):
+        x.remove()
+        count += 1
+
+print "%d files removed" % (count,)


More information about the Pypy-commit mailing list