FacetedFox

kconfig_html.py

Feb 27th, 2019
248
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import kconfiglib
  4. import sys
  5.  
  6. def write_kconfig_html():
  7.     kconf = kconfiglib.Kconfig(sys.argv[1])
  8.     output = sys.argv[2]
  9.  
  10.     for sym in sorted(kconf.unique_defined_syms, key=lambda x: x.name):
  11.         for node in sym.nodes:
  12.             if node.help is not None:
  13.                 with open(
  14.                     '{}/CONFIG_{}.html'.format(output, sym.name),
  15.                     mode='wt'
  16.                 ) as f:
  17.                     f.write('\n'.join([
  18.                         '<details>',
  19.                         '<summary>CONFIG_{}</summary><p>'.format(sym.name),
  20.                         '<br>\n'.join(node.help.split('\n')),
  21.                         '</p></details>'
  22.                     ]))
  23.  
  24. if __name__ == '__main__':
  25.     write_kconfig_html()
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment