VULN_CHECK_I913V6 7mj 4dZddlZddlZddlZddlZddlZejjeje jjjddlmZdej fdZdededdfdZd d Zed k(reyy) a Script to auto generate the documentation for Netlink specifications. :copyright: Copyright (C) 2023 Breno Leitao :license: GPL Version 2, June 1991 see linux/COPYING for details. This script performs extensive parsing to the Linux kernel's netlink YAML spec files, in an effort to avoid needing to heavily mark up the original YAML file. It uses the library code from scripts/lib. N)YnlDocGeneratorreturnctjd}|jddd|jddd |j}|jd d d |j }|j r$t jt j|jr^tjj|js5t jd|jtjd|j s*t j"dtjdtjj|j r t j$d|j |S)zParse arguments from userzNetlink RST generator) descriptionz-vz --verbose store_true)actionz-oz--outputzOutput file name)helpz-iz--inputzYAML file name)levelz%s is not a valid file.zNo output file specified.z"%s already exists. Overwriting it.)argparseArgumentParser add_argumentadd_mutually_exclusive_group parse_argsverboselogging basicConfigDEBUGinputospathisfilewarningsysexitoutputerrordebug)parsergroupargss 6/usr/lib/python3.12/site-packages/pyynl/ynl_gen_rst.pyparse_argumentsr#s  $ $1H IF k,? j/AB  / / 1E tY-=>    D ||'--0 zz"''..414::>  ;; 12   ww~~dkk" :DKKH Kcontentfilenamectjd|t|dd5}|j|dddy#1swYyxYw)z,Write the generated content into an RST filezSaving RST file to %swzutf-8)encodingN)rropenwrite)r%r&rst_files r"write_to_rstfiler-7s7 MM)84 hg .(w / . .s AA ct}t}|jrptjd|j |j t jj|j}t|jyy#t$rT}tjd|jtj|tjdYd}~pd}~wwxYw)zCMain function that reads the YAML files and generates the RST filesz Parsing %szFailed to parse %s.r N)r#rrrrparse_yaml_filerrjoin Exceptionrrrr-r)r!rr% exceptions r"mainr3?s  D  F zz lDJJ/ ,,RWW\\$**-EFG $++.  OO14:: > OOI & HHRLL s8B C/A C**C/__main__)rN)__doc__os.pathrpathlibrr rrappendPath__file__resolveparentas_posixlibr Namespacer#strr-r3__name__r$r"rCs    X&..077@@BC++< c S T /& zFr$