Merge pull request #2023 from screamerbg/misc-scripts

Move non-essential scripts to tools/misc/
pull/2031/head
Martin Kojtal 2016-06-27 17:51:56 +02:00 committed by GitHub
commit 2acd3bbf2f
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python
import os
import re
def main(path='.', pattern=r'#include\s+"([^"]*\.(?:c|cpp))"'):
pattern = re.compile(pattern)
for root, dirs, files in os.walk(path, followlinks=True):
for file in files:
with open(os.path.join(root, file)) as f:
for line in f.read().splitlines():
m = re.search(pattern, line)
if m:
print os.path.relpath(os.path.join(root, m.group(1)))
if __name__ == "__main__":
import sys
main(*sys.argv[1:])