summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2002-08-09 10:17:28 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2002-08-09 10:17:28 (GMT)
commitf1148f0bb3b227baac1708221cbf818427365c09 (patch)
tree9f783eeabfc5b7853dd19fd919bd94f01c5beb89
parentdc391a67e39df5f23d62d50b4cdb74728c24684e (diff)
downloadcpython-f1148f0bb3b227baac1708221cbf818427365c09.zip
cpython-f1148f0bb3b227baac1708221cbf818427365c09.tar.gz
cpython-f1148f0bb3b227baac1708221cbf818427365c09.tar.bz2
Patch by Russel Owen: if we have command line arguments zap pyc files
in the directories given.
-rw-r--r--Mac/scripts/zappycfiles.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/Mac/scripts/zappycfiles.py b/Mac/scripts/zappycfiles.py
index dbe95b6..22a021c 100644
--- a/Mac/scripts/zappycfiles.py
+++ b/Mac/scripts/zappycfiles.py
@@ -1,23 +1,26 @@
-# Zap .pyc files
+#!/usr/local/bin/python
+"""Recursively zap all .pyc files"""
import os
import sys
+# set doit true to actually delete files
+# set doit false to just print what would be deleted
doit = 1
def main():
- if os.name == 'mac':
- import macfs
- fss, ok = macfs.GetDirectory('Directory to zap pyc files in')
- if not ok:
- sys.exit(0)
- dir = fss.as_pathname()
- zappyc(dir)
- else:
- if not sys.argv[1:]:
+ if not sys.argv[1:]:
+ if os.name == 'mac':
+ import macfs
+ fss, ok = macfs.GetDirectory('Directory to zap pyc files in')
+ if not ok:
+ sys.exit(0)
+ dir = fss.as_pathname()
+ zappyc(dir)
+ else:
print 'Usage: zappyc dir ...'
sys.exit(1)
- for dir in sys.argv[1:]:
- zappyc(dir)
+ for dir in sys.argv[1:]:
+ zappyc(dir)
def zappyc(dir):
os.path.walk(dir, walker, None)