Skip to content

Commit 51fdce3

Browse files
committed
Switch how we do groups
1 parent 2959acd commit 51fdce3

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

tools/docs_gen.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33

44
from os.path import dirname, join
5+
from os import sep
56

67
import subprocess
78

@@ -12,6 +13,7 @@ def generate_documentation(dirs, output_dir):
1213
dirs - the directories that doxygen should scan for documentation
1314
output_dir - location of the documentation after the return of this function
1415
"""
16+
print dirs
1517
with open(join(dirname(__file__), "Doxyfile")) as doxyfile:
1618
proc = subprocess.Popen(["doxygen", "-"], stdin=subprocess.PIPE)
1719
proc.stdin.write(doxyfile.read())
@@ -32,17 +34,20 @@ def generate_documentation(dirs, output_dir):
3234
toolchain = GCC_ARM(TARGET_MAP["Super_Target"])
3335
resources = toolchain.scan_resources(".")
3436
for src in resources.headers:
35-
with open(src) as fd:
36-
contents = fd.read()
37-
with open(src, "w+") as fd:
38-
fd.write("/** \\addtogroup feature_mbed_os */\n/** @{{*/\n{:s}\n/** @}}*/\n".format(contents))
37+
if len(src.split(sep)) > 2:
38+
name = src.split(sep)[1]
39+
if name == "features":
40+
name = src.split(sep)[2]
41+
with open(src) as fd:
42+
contents = fd.read()
43+
with open(src, "w+") as fd:
44+
fd.write("/** \\addtogroup {:s} */\n/** @{{*/\n{:s}\n/** @}}*/\n".format(name,contents))
3945
for name, res in resources.features.iteritems():
4046
for src in res.headers:
4147
with open(src) as fd:
4248
contents = fd.read()
4349
with open(src, "w+") as fd:
44-
fd.write("/** \\addtogroup feature_{:s} */\n/** @{{*/\n{:s}\n/** @}}*/\n".format(name.lower(),contents))
50+
fd.write("/** \\addtogroup FEATURE_{:s} */\n/** @{{*/\n{:s}\n/** @}}*/\n".format(name,contents))
4551

46-
generate_documentation(sum(map(lambda x:x.headers, resources.features.values()), resources.headers),
52+
generate_documentation(filter(lambda x: "targets" not in x, sum(map(lambda x:x.headers, resources.features.values()), resources.headers)),
4753
join(dirname(dirname(__file__)), "mbed-docs"))
48-
print resources

0 commit comments

Comments
 (0)