[Python-checkins] python/dist/src/Mac/scripts zappycfiles.py,1.1,1.2

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Fri, 09 Aug 2002 03:17:30 -0700


Update of /cvsroot/python/python/dist/src/Mac/scripts
In directory usw-pr-cvs1:/tmp/cvs-serv16401

Modified Files:
	zappycfiles.py 
Log Message:
Patch by Russel Owen: if we have command line arguments zap pyc files
in the directories given.


Index: zappycfiles.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/scripts/zappycfiles.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** zappycfiles.py	23 Jan 2001 22:45:52 -0000	1.1
--- zappycfiles.py	9 Aug 2002 10:17:28 -0000	1.2
***************
*** 1,22 ****
! # Zap .pyc files
  import os
  import sys
  
  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:]:
  			print 'Usage: zappyc dir ...'
  			sys.exit(1)
! 		for dir in sys.argv[1:]:
! 			zappyc(dir)
  
  def zappyc(dir):
--- 1,25 ----
! #!/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 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)
  
  def zappyc(dir):