Tools to remove stale pyc files
This commit is contained in:
parent
6dd82353bb
commit
133c83ed8e
1 changed files with 13 additions and 0 deletions
13
tools/stale_pyc.py
Executable file
13
tools/stale_pyc.py
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
|
||||
verbose = '-v' in sys.argv
|
||||
for dirpath, dirnames, filenames in os.walk(root):
|
||||
for filename in filenames:
|
||||
if filename.endswith('.pyc') or filename.endswith('pyo'):
|
||||
if not os.path.exists(os.path.join(dirpath, filename[:-1])):
|
||||
os.unlink(os.path.join(dirpath, filename))
|
||||
if verbose:
|
||||
print os.path.join(dirpath, filename)
|
||||
Loading…
Add table
Add a link
Reference in a new issue