Skip to content

Commit 2acd3bb

Browse files
authored
Merge pull request #2023 from screamerbg/misc-scripts
Move non-essential scripts to tools/misc/
2 parents 104b8fa + 925781c commit 2acd3bb

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tools/misc/find_c_includes.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
3+
import os
4+
import re
5+
6+
def main(path='.', pattern=r'#include\s+"([^"]*\.(?:c|cpp))"'):
7+
pattern = re.compile(pattern)
8+
9+
for root, dirs, files in os.walk(path, followlinks=True):
10+
for file in files:
11+
with open(os.path.join(root, file)) as f:
12+
for line in f.read().splitlines():
13+
m = re.search(pattern, line)
14+
if m:
15+
print os.path.relpath(os.path.join(root, m.group(1)))
16+
17+
18+
if __name__ == "__main__":
19+
import sys
20+
main(*sys.argv[1:])
21+
File renamed without changes.

0 commit comments

Comments
 (0)