Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Nov 11 20:59:50 2016 +0000
Revision:
0:5c4d7b2438d3
Initial commit

Who changed what in which revision?

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