mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-30 11:12:29 +00:00 
			
		
		
		
	Docs: Group commands
Removes group parsing from command ref domain, instead relying on a 'groups' object in the cmds.json file. `docs/source/cmd` is no longer ignored or cleaned.
This commit is contained in:
		
							parent
							
								
									8d1b9b1c1f
								
							
						
					
					
						commit
						929c437b26
					
				
					 21 changed files with 113 additions and 26 deletions
				
			
		
							
								
								
									
										1
									
								
								docs/.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								docs/.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -1,5 +1,4 @@ | |||
| /build/ | ||||
| /source/cmd | ||||
| /source/generated | ||||
| /source/_images/**/*.log | ||||
| /source/_images/**/*.aux | ||||
|  |  | |||
|  | @ -47,7 +47,7 @@ help: | |||
| .PHONY: clean | ||||
| clean: clean-examples | ||||
| 	rm -rf $(BUILDDIR)/* | ||||
| 	rm -rf source/cmd util/__pycache__ | ||||
| 	rm -rf util/__pycache__ | ||||
| 	rm -rf source/generated | ||||
| 	$(MAKE) -C source/_images clean | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										5
									
								
								docs/source/cmd/index_backends.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_backends.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| backends | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: backends | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_formal.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_formal.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| formal | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: formal | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_frontends.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_frontends.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| frontends | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: frontends | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_kernel.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_kernel.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| kernel | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: kernel | ||||
|    :members: | ||||
							
								
								
									
										7
									
								
								docs/source/cmd/index_other.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								docs/source/cmd/index_other.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| Other commands | ||||
| ============== | ||||
| 
 | ||||
| Unknown source location | ||||
| 
 | ||||
| .. autocmdgroup:: unknown | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_cmds.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_cmds.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/cmds | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/cmds | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_equiv.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_equiv.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/equiv | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/equiv | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_fsm.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_fsm.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/fsm | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/fsm | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_hierarchy.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_hierarchy.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/hierarchy | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/hierarchy | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_memory.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_memory.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/memory | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/memory | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_opt.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_opt.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/opt | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/opt | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_pmgen.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_pmgen.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/pmgen | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/pmgen | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_proc.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_proc.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/proc | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/proc | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_sat.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_sat.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/sat | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/sat | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_techmap.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_techmap.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/techmap | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/techmap | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_passes_tests.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_passes_tests.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| passes/tests | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: passes/tests | ||||
|    :members: | ||||
							
								
								
									
										5
									
								
								docs/source/cmd/index_techlibs.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								docs/source/cmd/index_techlibs.rst
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| techlibs | ||||
| ------------------ | ||||
| 
 | ||||
| .. autocmdgroup:: techlibs | ||||
|    :members: | ||||
|  | @ -9,8 +9,14 @@ Command line reference | |||
| 
 | ||||
| .. toctree:: | ||||
|    :caption: Command reference | ||||
| 	:maxdepth: 1 | ||||
|    :maxdepth: 2 | ||||
|    :glob: | ||||
| 
 | ||||
|    /appendix/env_vars | ||||
| 	/cmd/* | ||||
|    /cmd/index_backends | ||||
|    /cmd/index_frontends | ||||
|    /cmd/index_kernel | ||||
|    /cmd/index_formal | ||||
|    /cmd/index_passes* | ||||
|    /cmd/index_techlibs | ||||
|    /cmd/index_other | ||||
|  |  | |||
|  | @ -48,26 +48,31 @@ class YosysCmd: | |||
|     name: str | ||||
|     title: str | ||||
|     content: list[YosysCmdContentListing] | ||||
|     group: str | ||||
|     source_file: str | ||||
|     source_line: int | ||||
|     source_func: str | ||||
|     experimental_flag: bool | ||||
| 
 | ||||
|     def __init__( | ||||
|             self, | ||||
|             name:str = "", title:str = "", | ||||
|             content: list[dict[str]] = [], | ||||
|             source_file:str = 'unknown', | ||||
|             group: str = 'unknown', | ||||
|             source_file: str = "", | ||||
|             source_line: int = 0, | ||||
|             source_func: str = "", | ||||
|             experimental_flag: bool = False | ||||
|     ) -> None: | ||||
|         self.name = name | ||||
|         self.title = title | ||||
|         self.content = [YosysCmdContentListing(**c) for c in content] | ||||
|         self.group = group | ||||
|         self.source_file = source_file | ||||
|         self.source_line = source_line | ||||
|         self.source_func = source_func | ||||
|         self.experimental_flag = experimental_flag | ||||
|      | ||||
|     @property | ||||
|     def source_line(self) -> int: | ||||
|         return 0 | ||||
|      | ||||
| class YosysCmdGroupDocumenter(Documenter): | ||||
|     objtype = 'cmdgroup' | ||||
|     priority = 10 | ||||
|  | @ -97,18 +102,7 @@ class YosysCmdGroupDocumenter(Documenter): | |||
|                     subtype = 'cmd_lib' | ||||
|                 ) | ||||
|                 cmds_obj = {} | ||||
|             for (name, obj) in cmds_obj.get('cmds', {}).items(): | ||||
|                 if self.lib_key == 'groups': | ||||
|                     source_file: str = obj.get('source_file', 'unknown') | ||||
|                     if source_file == 'unknown': | ||||
|                         source_group = 'unknown' | ||||
|                     else: | ||||
|                         source_group = str(Path(source_file).parent) | ||||
|                     try: | ||||
|                         self.__cmd_lib[source_group].append(name) | ||||
|                     except KeyError: | ||||
|                         self.__cmd_lib[source_group] = [name,] | ||||
|                 else: | ||||
|             for (name, obj) in cmds_obj.get(self.lib_key, {}).items(): | ||||
|                 self.__cmd_lib[name] = obj | ||||
|         return self.__cmd_lib | ||||
|      | ||||
|  | @ -332,6 +326,7 @@ class YosysCmdDocumenter(YosysCmdGroupDocumenter): | |||
|         # set sourcename and add content from attribute documentation | ||||
|         domain = getattr(self, 'domain', self.objtype) | ||||
|         source_name = self.object.source_file | ||||
|         source_line = self.object.source_line | ||||
| 
 | ||||
|         def render(content_list: YosysCmdContentListing, indent: int=0): | ||||
|             content_source = content_list.source_file or source_name | ||||
|  | @ -363,7 +358,7 @@ class YosysCmdDocumenter(YosysCmdGroupDocumenter): | |||
| 
 | ||||
|         if self.get_sourcename() != 'unknown': | ||||
|             self.add_line('\n', source_name) | ||||
|             self.add_line(f'.. note:: Help text automatically generated from :file:`{source_name}`', source_name) | ||||
|             self.add_line(f'.. note:: Help text automatically generated from :file:`{source_name}:{source_line}`', source_name) | ||||
| 
 | ||||
|         # add additional content (e.g. from document), if present | ||||
|         if more_content: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue