Skip to content

Commit 047b27b

Browse files
committed
add json dump
1 parent c36485a commit 047b27b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/spec_xml/generate_spec_xml.py

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616

1717
import glob
18+
import json
1819
import os
1920
import re
2021
import subprocess
@@ -176,13 +177,19 @@ def dump_cluster_ids(output_dir):
176177
title = f'|{title_id_decimal}|{title_id_hex}|{title_name}|\n'
177178
hashes = f'|{"-" * dec_len}|{"-" * hex_len}|{"-" * name_len}|\n'
178179
s = title + hashes
180+
json_dict = {id: c.name for id, c in sorted(clusters.items())}
179181
for id, cluster in sorted(clusters.items()):
180182
hex_id = f'0x{id:04X}'
181183
s += f'|{id:<{dec_len}}|{hex_id:<{hex_len}}|{cluster.name:<{name_len}}|\n'
184+
182185
with open(DEFAULT_DOCUMENTATION_DIR, 'w') as fout:
183186
fout.write(header)
184187
fout.write(s)
185188

189+
json_file = os.path.join(clusters_output_dir, 'cluster_ids.json')
190+
with open(json_file, "w") as outfile:
191+
json.dump(json_dict, outfile, indent=2)
192+
186193

187194
if __name__ == '__main__':
188195
main()

0 commit comments

Comments
 (0)