mbed os with nrf51 internal bandgap enabled to read battery level
Dependents: BLE_file_test BLE_Blink ExternalEncoder
tools/misc/docs_gen.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 | """An api for generating documentation from the codebase |
elessair | 0:f269e3021894 | 2 | """ |
elessair | 0:f269e3021894 | 3 | |
elessair | 0:f269e3021894 | 4 | from os.path import dirname, join |
elessair | 0:f269e3021894 | 5 | from os import sep |
elessair | 0:f269e3021894 | 6 | from re import compile |
elessair | 0:f269e3021894 | 7 | |
elessair | 0:f269e3021894 | 8 | import subprocess |
elessair | 0:f269e3021894 | 9 | |
elessair | 0:f269e3021894 | 10 | def generate_documentation(dirs, output_dir): |
elessair | 0:f269e3021894 | 11 | """Use doxygen to generate the documentation |
elessair | 0:f269e3021894 | 12 | |
elessair | 0:f269e3021894 | 13 | Positional arguments: |
elessair | 0:f269e3021894 | 14 | dirs - the directories that doxygen should scan for documentation |
elessair | 0:f269e3021894 | 15 | output_dir - location of the documentation after the return of this function |
elessair | 0:f269e3021894 | 16 | """ |
elessair | 0:f269e3021894 | 17 | print dirs |
elessair | 0:f269e3021894 | 18 | with open(join(dirname(__file__), "Doxyfile")) as doxyfile: |
elessair | 0:f269e3021894 | 19 | proc = subprocess.Popen(["doxygen", "-"], stdin=subprocess.PIPE) |
elessair | 0:f269e3021894 | 20 | proc.stdin.write(doxyfile.read()) |
elessair | 0:f269e3021894 | 21 | proc.stdin.write("OUTPUT_DIRECTORY={}\n".format(output_dir)) |
elessair | 0:f269e3021894 | 22 | proc.stdin.write("INPUT={}".format(" ".join(dirs))) |
elessair | 0:f269e3021894 | 23 | proc.stdin.close() |
elessair | 0:f269e3021894 | 24 | proc.wait() |
elessair | 0:f269e3021894 | 25 | |
elessair | 0:f269e3021894 | 26 | EXCLUDES = ["targets", "features/FEATURE", "features/mbedtls", |
elessair | 0:f269e3021894 | 27 | "features/nanostack", "features/storage"] |
elessair | 0:f269e3021894 | 28 | |
elessair | 0:f269e3021894 | 29 | def is_not_excluded(src): |
elessair | 0:f269e3021894 | 30 | return all(exclude not in src for exclude in EXCLUDES) |
elessair | 0:f269e3021894 | 31 | |
elessair | 0:f269e3021894 | 32 | if __name__ == "__main__": |
elessair | 0:f269e3021894 | 33 | import sys |
elessair | 0:f269e3021894 | 34 | from os.path import abspath, dirname, join |
elessair | 0:f269e3021894 | 35 | # Be sure that the tools directory is in the search path |
elessair | 0:f269e3021894 | 36 | ROOT = abspath(join(dirname(__file__), "..", "..")) |
elessair | 0:f269e3021894 | 37 | sys.path.insert(0, ROOT) |
elessair | 0:f269e3021894 | 38 | |
elessair | 0:f269e3021894 | 39 | from tools.toolchains.gcc import GCC_ARM |
elessair | 0:f269e3021894 | 40 | from tools.targets import TARGET_MAP |
elessair | 0:f269e3021894 | 41 | toolchain = GCC_ARM(TARGET_MAP["Super_Target"]) |
elessair | 0:f269e3021894 | 42 | resources = toolchain.scan_resources(".") |
elessair | 0:f269e3021894 | 43 | generate_documentation(filter(is_not_excluded, |
elessair | 0:f269e3021894 | 44 | sum(map(lambda x:x.headers, |
elessair | 0:f269e3021894 | 45 | resources.features.values()), |
elessair | 0:f269e3021894 | 46 | resources.headers)), |
elessair | 0:f269e3021894 | 47 | join(dirname(dirname(__file__)), "mbed-docs")) |