python modernize.py --no-six -f libmodernize.fixes.fix_print -w With manual fixes as the import was put always on top.
22 lines
724 B
Python
Executable file
22 lines
724 B
Python
Executable file
#!/usr/bin/env python
|
|
from __future__ import print_function
|
|
|
|
import os
|
|
import sys
|
|
|
|
root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
|
|
verbose = '-v' in sys.argv
|
|
excludes = ('.git', '.svn', '__pycache__')
|
|
|
|
for dirpath, dirnames, filenames in os.walk(root):
|
|
for exclude in excludes:
|
|
try:
|
|
dirnames.remove(exclude)
|
|
except ValueError:
|
|
pass
|
|
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))
|