Clone of official tools
Diff: misc/find_c_includes.py
- Revision:
- 36:96847d42f010
- Parent:
- 35:da9c89f8be7d
- Child:
- 37:f8cfeb185c30
--- a/misc/find_c_includes.py Wed Feb 15 13:53:18 2017 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -#!/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:]) -