Development mbed library for MAX32630FTHR
Dependents: blinky_max32630fthr
Diff: tools/misc/find_c_includes.py
- Revision:
- 0:5c4d7b2438d3
diff -r 000000000000 -r 5c4d7b2438d3 tools/misc/find_c_includes.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/misc/find_c_includes.py Fri Nov 11 20:59:50 2016 +0000 @@ -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:]) +