[meta-freescale] [Documentation][PATCH 13/31] scripts: Improve SoCs blockdiag style
Daiane Angolini
daiane.list at gmail.com
Fri Oct 24 18:14:56 PDT 2014
From: Lucas Dutra Nunes <ldnunes at ossystems.com.br>
Use the Liberation font and apply anti-aliasing.
Signed-off-by: Lucas Dutra Nunes <ldnunes at ossystems.com.br>
Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---
release-notes/source/conf.py | 2 ++
release-notes/source/soc-tree.diag | 19 +++++-----
scripts/bitbake-metadata2doc.py | 71 ++++++++++++++++++++------------------
3 files changed, 50 insertions(+), 42 deletions(-)
diff --git a/release-notes/source/conf.py b/release-notes/source/conf.py
index a663426..fb6070d 100644
--- a/release-notes/source/conf.py
+++ b/release-notes/source/conf.py
@@ -26,6 +26,8 @@ import sys, os
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinxcontrib.blockdiag']
+blockdiag_fontpath = '/usr/share/fonts/truetype/liberation/LiberationMono-Regular.ttf'
+blockdiag_antialias = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
diff --git a/release-notes/source/soc-tree.diag b/release-notes/source/soc-tree.diag
index d082af9..cfed01d 100644
--- a/release-notes/source/soc-tree.diag
+++ b/release-notes/source/soc-tree.diag
@@ -1,9 +1,12 @@
-blockdiag {
-
- mx3 -> mx31, mx35;
- mx5 -> mx51, mx53;
- mx6 -> mx6dl, mx6q, mx6sl;
- mxs -> mx23, mx28;
- vf60;
+blockdiag SoCs {
+ i.MX -> mx3 -> mx31;
+ i.MX -> mx3 -> mx35;
+ i.MX -> mx5 -> mx51;
+ i.MX -> mx5 -> mx53;
+ i.MX -> mx6 -> mx6dl;
+ i.MX -> mx6 -> mx6q;
+ i.MX -> mx6 -> mx6sl;
+ i.MX -> mxs -> mx23;
+ i.MX -> mxs -> mx28;
+ Vybrid -> vf60;
}
-
diff --git a/scripts/bitbake-metadata2doc.py b/scripts/bitbake-metadata2doc.py
index 6eb8d27..2e2fce5 100644
--- a/scripts/bitbake-metadata2doc.py
+++ b/scripts/bitbake-metadata2doc.py
@@ -381,36 +381,20 @@ def write_machines_list(data, out_dir, bsp_dir):
def write_soc_tree(data, out_dir):
- soc_families = []
- for board, board_data in data.items():
- soc_family = board_data['soc-family']
- if soc_family not in soc_families:
- soc_families.append(soc_family)
-
- max_depth = 2
- socs = map(lambda i: i[0][0:max_depth],
- zip(map(lambda soc_family: soc_family.split(':'),
- soc_families)))
-
- def indent(label, level, fd, last=False):
- if level == 0:
- padding = ' '
- else:
- padding = ' â'
- if last:
- corner = 'â'
- else:
- corner = 'â'
- fd.write(padding + (' ' * 4 * level) + corner + 'ââ ' + label + '\n')
-
- def print_tree(tree, fd, level=0):
- parents = sorted(tree.keys())
- len_parents = len(parents)
- for i, parent in enumerate(parents):
- indent(parent, level, fd, i == len_parents -1)
- children = tree[parent]
- if children:
- print_tree(children, fd, level + 1)
+ SOCS_FAMILIES = {
+ re.compile("mx(\d|s)"): 'i.MX',
+ re.compile("vf(\d+)"): 'Vybrid'
+ }
+
+ PADDING=" "
+
+ def print_tree(tree, fd, padding=PADDING):
+ for key in sorted(tree.keys(), key=lambda s: s.lower()):
+ value = tree[key]
+ if any(value):
+ print_tree(value, fd, padding + key + " -> ")
+ else:
+ fd.write(padding + key + ";\n")
def dict_merge(a, b):
if not isinstance(b, dict):
@@ -431,12 +415,31 @@ def write_soc_tree(data, out_dir):
tree = dict_merge(tree, tmp)
return tree
- out_file = os.path.join(out_dir, 'soc-tree.inc')
+ soc_families = []
+ for board, board_data in data.items():
+ soc_family = board_data['soc-family']
+ if soc_family not in soc_families:
+ soc_families.append(soc_family)
+
+ max_depth = 2
+ socs = map(lambda i: i[0][0:max_depth],
+ zip(map(lambda soc_family: soc_family.split(':'),
+ soc_families)))
+
+ socs_dict = {}
+ for key, value in socs2dict(socs).iteritems():
+ for pattern, family in SOCS_FAMILIES.iteritems():
+ if pattern.match(key):
+ if not family in socs_dict.keys():
+ socs_dict[family] = {}
+ socs_dict[family][key] = value
+
+ out_file = os.path.join(out_dir, 'soc-tree.diag')
info('Writing %s' % out_file)
fd = open(out_file, 'w')
- fd.write('.. code-block:: none\n\n')
- fd.write(' SoCs\n')
- print_tree(socs2dict(socs), fd)
+ fd.write("blockdiag SoCs {\n")
+ print_tree(socs_dict, fd)
+ fd.write("}\n")
fd.close()
def write_recipe_descriptions(recipe_pattern, data, out_file):
--
1.9.1
More information about the meta-freescale
mailing list