Skip to content

Commit

Permalink
Undo changes necessary for ansible-community#65.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Dec 27, 2022
1 parent 7094316 commit aeef3fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/antsibull_docs/cli/doc_commands/stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def generate_docs_for_all_collections(venv: t.Union[VenvRunner, FakeVenvRunner],
collection_install=collection_install,
for_official_docsite=for_official_docsite))
flog.notice('Finished writing plugin indexes')
asyncio_run(output_callback_indexes(callback_plugin_contents, collection_metadata,
asyncio_run(output_callback_indexes(callback_plugin_contents,
dest_dir, collection_url=collection_url,
collection_install=collection_install,
for_official_docsite=for_official_docsite))
Expand Down
19 changes: 2 additions & 17 deletions src/antsibull_docs/write_docs/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

async def write_callback_type_index(callback_type: str,
per_collection_plugins: t.Mapping[str, t.Mapping[str, str]],
collection_metadata: t.Mapping[str, AnsibleCollectionMetadata],
template: Template,
dest_filename: str,
for_official_docsite: bool = False) -> None:
Expand All @@ -36,28 +35,16 @@ async def write_callback_type_index(callback_type: str,
:arg callback_type: The callback plugin type to write the index for.
:arg per_collection_plugins: Mapping of collection_name to Mapping of plugin_name to
short_description.
:arg collection_metadata: Dictionary mapping collection names to collection metadata objects.
:arg template: A template to render the plugin index.
:arg dest_filename: The destination filename.
:kwarg for_official_docsite: Default False. Set to True to use wording specific for the
official docsite on docs.ansible.com.
"""
public_per_collection_plugins = {}
for collection_name, plugins in per_collection_plugins.items():
public_plugins = {}
collection_meta = collection_metadata[collection_name]
private_plugins = collection_meta.private_plugins.get('callback') or []
for plugin_name, plugin_data in plugins.items():
if plugin_name not in private_plugins:
public_plugins[plugin_name] = plugin_data
if public_plugins:
public_per_collection_plugins[collection_name] = public_plugins

index_contents = _render_template(
template,
dest_filename,
callback_type=callback_type,
per_collection_plugins=public_per_collection_plugins,
per_collection_plugins=per_collection_plugins,
for_official_docsite=for_official_docsite,
)

Expand Down Expand Up @@ -92,7 +79,6 @@ async def write_plugin_type_index(plugin_type: str,


async def output_callback_indexes(plugin_info: PluginCollectionInfoT,
collection_metadata: t.Mapping[str, AnsibleCollectionMetadata],
dest_dir: str,
collection_url: CollectionNameTransformer,
collection_install: CollectionNameTransformer,
Expand All @@ -103,7 +89,6 @@ async def output_callback_indexes(plugin_info: PluginCollectionInfoT,
:arg plugin_info: Mapping of callback_type to Mapping of collection_name to Mapping of
plugin_name to short_description.
:arg collection_metadata: Dictionary mapping collection names to collection metadata objects.
:arg dest_dir: The directory to place the documentation in.
:kwarg for_official_docsite: Default False. Set to True to use wording specific for the
official docsite on docs.ansible.com.
Expand Down Expand Up @@ -132,7 +117,7 @@ async def output_callback_indexes(plugin_info: PluginCollectionInfoT,
filename = os.path.join(collection_toplevel, f'callback_index_{callback_type}.rst')
writers.append(await pool.spawn(
write_callback_type_index(
callback_type, per_collection_data, collection_metadata, plugin_list_tmpl,
callback_type, per_collection_data, plugin_list_tmpl,
filename, for_official_docsite=for_official_docsite)))

await asyncio.gather(*writers)
Expand Down

0 comments on commit aeef3fb

Please sign in to comment.