FacetedFox icon

kconfig_html.py

FacetedFox | PRO | 02/27/19 07:55:00 PM UTC | 0 ⭐ | 279 👁️ | Never ⏰ | []
Python |

770 B

|

None

|

0 👍

/

0 👎

#!/usr/bin/python3
 
import kconfiglib
import sys
 
def write_kconfig_html():
    kconf = kconfiglib.Kconfig(sys.argv[1])
    output = sys.argv[2]
 
    for sym in sorted(kconf.unique_defined_syms, key=lambda x: x.name):
        for node in sym.nodes:
            if node.help is not None:
                with open(
                    '{}/CONFIG_{}.html'.format(output, sym.name),
                    mode='wt'
                ) as f:
                    f.write('\n'.join([
                        '<details>',
                        '<summary>CONFIG_{}</summary><p>'.format(sym.name),
                        '<br>\n'.join(node.help.split('\n')),
                        '</p></details>'
                    ]))
 
if __name__ == '__main__':
    write_kconfig_html()

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎