the other jimmy / mbed-sdk-tools

Fork of mbed-sdk-tools by mbed official

Committer:
The Other Jimmy
Date:
Wed Jan 04 11:58:24 2017 -0600
Revision:
31:182518299918
Update tools to follow mbed-os tools release 5.3.1

Who changed what in which revision?

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