mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
24 lines
700 B
Python
Executable file
24 lines
700 B
Python
Executable file
#!/usr/bin/python2
|
|
|
|
# a script to check for redundant fancy headers
|
|
|
|
import os, re, sys
|
|
|
|
oregex = re.compile('#(?:[\\s]+)?include [<|"](.*)[>|"]')
|
|
|
|
lall = []
|
|
for root, dirs, files in os.walk('%s/..' % os.getcwd()):
|
|
for sfile in files:
|
|
lall.append(os.path.basename(sfile))
|
|
|
|
lheaders = []
|
|
for root, dirs, files in os.walk(os.getcwd()):
|
|
for sfile in files:
|
|
sfull = '%s/%s' % (root, sfile)
|
|
with open(sfull, 'rb') as f:
|
|
content = f.read()
|
|
for smatch in oregex.findall(str(content)):
|
|
if not os.path.basename(smatch) in lall:
|
|
print(sfull, smatch)
|
|
if '--remove' in sys.argv:
|
|
os.unlink(sfull)
|