mbed os with nrf51 internal bandgap enabled to read battery level
Dependents: BLE_file_test BLE_Blink ExternalEncoder
tools/misc/find_c_includes.py@0:f269e3021894, 2016-10-23 (annotated)
- Committer:
- elessair
- Date:
- Sun Oct 23 15:10:02 2016 +0000
- Revision:
- 0:f269e3021894
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elessair | 0:f269e3021894 | 1 | #!/usr/bin/env python |
elessair | 0:f269e3021894 | 2 | |
elessair | 0:f269e3021894 | 3 | import os |
elessair | 0:f269e3021894 | 4 | import re |
elessair | 0:f269e3021894 | 5 | |
elessair | 0:f269e3021894 | 6 | def main(path='.', pattern=r'#include\s+"([^"]*\.(?:c|cpp))"'): |
elessair | 0:f269e3021894 | 7 | pattern = re.compile(pattern) |
elessair | 0:f269e3021894 | 8 | |
elessair | 0:f269e3021894 | 9 | for root, dirs, files in os.walk(path, followlinks=True): |
elessair | 0:f269e3021894 | 10 | for file in files: |
elessair | 0:f269e3021894 | 11 | with open(os.path.join(root, file)) as f: |
elessair | 0:f269e3021894 | 12 | for line in f.read().splitlines(): |
elessair | 0:f269e3021894 | 13 | m = re.search(pattern, line) |
elessair | 0:f269e3021894 | 14 | if m: |
elessair | 0:f269e3021894 | 15 | print os.path.relpath(os.path.join(root, m.group(1))) |
elessair | 0:f269e3021894 | 16 | |
elessair | 0:f269e3021894 | 17 | |
elessair | 0:f269e3021894 | 18 | if __name__ == "__main__": |
elessair | 0:f269e3021894 | 19 | import sys |
elessair | 0:f269e3021894 | 20 | main(*sys.argv[1:]) |
elessair | 0:f269e3021894 | 21 |