Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: misc/docs_gen.py
- Revision:
- 31:8ea194f6145b
diff -r f12ce67666d0 -r 8ea194f6145b misc/docs_gen.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/docs_gen.py Wed Jan 04 11:58:24 2017 -0600
@@ -0,0 +1,47 @@
+"""An api for generating documentation from the codebase
+"""
+
+from os.path import dirname, join
+from os import sep
+from re import compile
+
+import subprocess
+
+def generate_documentation(dirs, output_dir):
+ """Use doxygen to generate the documentation
+
+ Positional arguments:
+ dirs - the directories that doxygen should scan for documentation
+ output_dir - location of the documentation after the return of this function
+ """
+ print dirs
+ with open(join(dirname(__file__), "Doxyfile")) as doxyfile:
+ proc = subprocess.Popen(["doxygen", "-"], stdin=subprocess.PIPE)
+ proc.stdin.write(doxyfile.read())
+ proc.stdin.write("OUTPUT_DIRECTORY={}\n".format(output_dir))
+ proc.stdin.write("INPUT={}".format(" ".join(dirs)))
+ proc.stdin.close()
+ proc.wait()
+
+EXCLUDES = ["targets", "features/FEATURE", "features/mbedtls",
+ "features/nanostack", "features/storage"]
+
+def is_not_excluded(src):
+ return all(exclude not in src for exclude in EXCLUDES)
+
+if __name__ == "__main__":
+ import sys
+ from os.path import abspath, dirname, join
+ # Be sure that the tools directory is in the search path
+ ROOT = abspath(join(dirname(__file__), "..", ".."))
+ sys.path.insert(0, ROOT)
+
+ from tools.toolchains.gcc import GCC_ARM
+ from tools.targets import TARGET_MAP
+ toolchain = GCC_ARM(TARGET_MAP["Super_Target"])
+ resources = toolchain.scan_resources(".")
+ generate_documentation(filter(is_not_excluded,
+ sum(map(lambda x:x.headers,
+ resources.features.values()),
+ resources.headers)),
+ join(dirname(dirname(__file__)), "mbed-docs"))