Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools: ynl_gen_rst.py: drop support for generating index files

As we're now using an index file with a glob, there's no need
to generate index files anymore.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

-28
-28
tools/net/ynl/pyynl/ynl_gen_rst.py
··· 31 31 32 32 # Index and input are mutually exclusive 33 33 group = parser.add_mutually_exclusive_group() 34 - group.add_argument( 35 - "-x", "--index", action="store_true", help="Generate the index page" 36 - ) 37 34 group.add_argument("-i", "--input", help="YAML file name") 38 35 39 36 args = parser.parse_args() ··· 60 63 rst_file.write(content) 61 64 62 65 63 - def generate_main_index_rst(parser: YnlDocGenerator, output: str) -> None: 64 - """Generate the `networking_spec/index` content and write to the file""" 65 - lines = [] 66 - 67 - lines.append(parser.fmt.rst_header()) 68 - lines.append(parser.fmt.rst_label("specs")) 69 - lines.append(parser.fmt.rst_title("Netlink Family Specifications")) 70 - lines.append(parser.fmt.rst_toctree(1)) 71 - 72 - index_dir = os.path.dirname(output) 73 - logging.debug("Looking for .rst files in %s", index_dir) 74 - for filename in sorted(os.listdir(index_dir)): 75 - base, ext = os.path.splitext(filename) 76 - if filename == "index.rst" or ext not in [".rst", ".yaml"]: 77 - continue 78 - lines.append(f" {base}\n") 79 - 80 - logging.debug("Writing an index file at %s", output) 81 - write_to_rstfile("".join(lines), output) 82 - 83 - 84 66 def main() -> None: 85 67 """Main function that reads the YAML files and generates the RST files""" 86 68 ··· 77 101 sys.exit(-1) 78 102 79 103 write_to_rstfile(content, args.output) 80 - 81 - if args.index: 82 - # Generate the index RST file 83 - generate_main_index_rst(parser, args.output) 84 104 85 105 86 106 if __name__ == "__main__":