[py-svn] r36506 - py/dist/py/bin
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu Jan 11 16:46:58 CET 2007
Author: cfbolz
Date: Thu Jan 11 16:46:57 2007
New Revision: 36506
Modified:
py/dist/py/bin/py.cleanup
Log:
make py.cleanup use optparse (for future additions and a better help message).
Modified: py/dist/py/bin/py.cleanup
==============================================================================
--- py/dist/py/bin/py.cleanup (original)
+++ py/dist/py/bin/py.cleanup Thu Jan 11 16:46:57 2007
@@ -1,12 +1,26 @@
#!/usr/bin/env python
+"""\
+py.cleanup [PATH]
+
+Delete pyc file recursively, starting from PATH (which defaults to the current
+working directory). Don't follow links and don't recurse into directories with
+a ".".
+"""
from _findpy import py
import py
+from py.compat import optparse
+
+parser = optparse.OptionParser(usage=__doc__)
-if len(py.std.sys.argv) > 1:
- path = py.path.local(py.std.sys.argv[1])
-else:
- path = py.path.local()
-print "cleaning path", path
-for x in path.visit('*.pyc', lambda x: x.check(dotfile=0, link=0)):
- x.remove()
+if __name__ == '__main__':
+ (options, args) = parser.parse_args()
+
+ string = args[0]
+ if len(args) >= 1:
+ path = py.path.local(args)
+ else:
+ path = py.path.local()
+ print "cleaning path", path
+ for x in path.visit('*.pyc', lambda x: x.check(dotfile=0, link=0)):
+ x.remove()
More information about the pytest-commit
mailing list