Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tools/misc/find_c_includes.py
Original file line number Diff line number Diff line change
@@ -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:])

File renamed without changes.