mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	 9545a23c7f
			
		
	
	
		9545a23c7f
		
	
	
	
	
		
			
			to "sys.platform == 'mac'" and that is dead code because it refers to a platform that is no longer supported (and hasn't been supported for several releases). Fixes issue #7908 for the trunk.
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			658 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			658 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| #!/usr/bin/env python
 | |
| """Recursively zap all .pyc and .pyo 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:]:
 | |
|         print 'Usage: zappyc dir ...'
 | |
|         sys.exit(1)
 | |
|     for dir in sys.argv[1:]:
 | |
|         zappyc(dir)
 | |
| 
 | |
| def zappyc(dir):
 | |
|     os.path.walk(dir, walker, None)
 | |
| 
 | |
| def walker(dummy, top, names):
 | |
|     for name in names:
 | |
|         if name[-4:] in ('.pyc', '.pyo'):
 | |
|             path = os.path.join(top, name)
 | |
|             print 'Zapping', path
 | |
|             if doit:
 | |
|                 os.unlink(path)
 | |
| 
 | |
| if __name__ == '__main__':
 | |
|     main()
 |