takashi kadono
/
Nucleo_446
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/tools/misc/find_c_includes.py@3:f3764f852aa8, 2018-10-11 (annotated)
- Committer:
- kadonotakashi
- Date:
- Thu Oct 11 02:27:46 2018 +0000
- Revision:
- 3:f3764f852aa8
- Parent:
- 0:8fdf9a60065b
Nucreo 446 + SSD1331 test version;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | #!/usr/bin/env python |
kadonotakashi | 0:8fdf9a60065b | 2 | |
kadonotakashi | 0:8fdf9a60065b | 3 | import os |
kadonotakashi | 0:8fdf9a60065b | 4 | import re |
kadonotakashi | 0:8fdf9a60065b | 5 | |
kadonotakashi | 0:8fdf9a60065b | 6 | def main(path='.', pattern=r'#include\s+"([^"]*\.(?:c|cpp))"'): |
kadonotakashi | 0:8fdf9a60065b | 7 | pattern = re.compile(pattern) |
kadonotakashi | 0:8fdf9a60065b | 8 | |
kadonotakashi | 0:8fdf9a60065b | 9 | for root, dirs, files in os.walk(path, followlinks=True): |
kadonotakashi | 0:8fdf9a60065b | 10 | for file in files: |
kadonotakashi | 0:8fdf9a60065b | 11 | with open(os.path.join(root, file)) as f: |
kadonotakashi | 0:8fdf9a60065b | 12 | for line in f.read().splitlines(): |
kadonotakashi | 0:8fdf9a60065b | 13 | m = re.search(pattern, line) |
kadonotakashi | 0:8fdf9a60065b | 14 | if m: |
kadonotakashi | 0:8fdf9a60065b | 15 | print os.path.relpath(os.path.join(root, m.group(1))) |
kadonotakashi | 0:8fdf9a60065b | 16 | |
kadonotakashi | 0:8fdf9a60065b | 17 | |
kadonotakashi | 0:8fdf9a60065b | 18 | if __name__ == "__main__": |
kadonotakashi | 0:8fdf9a60065b | 19 | import sys |
kadonotakashi | 0:8fdf9a60065b | 20 | main(*sys.argv[1:]) |
kadonotakashi | 0:8fdf9a60065b | 21 |