From f6889719e474d178465b77666e068b5e352ffbcb Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 26 Nov 2022 15:00:39 +0100 Subject: [PATCH] Always provide metadata of ansible.builtin. --- src/antsibull_docs/data/collection-enum.py | 9 ++++----- src/antsibull_docs/docs_parsing/ansible_doc.py | 11 +++++------ src/antsibull_docs/docs_parsing/parsing.py | 5 +++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/antsibull_docs/data/collection-enum.py b/src/antsibull_docs/data/collection-enum.py index 692639c4..b988727a 100644 --- a/src/antsibull_docs/data/collection-enum.py +++ b/src/antsibull_docs/data/collection-enum.py @@ -249,11 +249,10 @@ def main(args): collection_name = f'{meta["namespace"]}.{meta["name"]}' if match_filter(collection_name, coll_filter): result['collections'][collection_name] = meta - if match_filter('ansible.builtin', coll_filter): - result['collections']['ansible.builtin'] = { - 'path': os.path.dirname(ansible_release.__file__), - 'version': ansible_release.__version__, - } + result['collections']['ansible.builtin'] = { + 'path': os.path.dirname(ansible_release.__file__), + 'version': ansible_release.__version__, + } print(json.dumps( result, cls=AnsibleJSONEncoder, sort_keys=True, indent=4 if arguments.pretty else None)) diff --git a/src/antsibull_docs/docs_parsing/ansible_doc.py b/src/antsibull_docs/docs_parsing/ansible_doc.py index c4ab64b3..b74b3448 100644 --- a/src/antsibull_docs/docs_parsing/ansible_doc.py +++ b/src/antsibull_docs/docs_parsing/ansible_doc.py @@ -217,12 +217,11 @@ def get_collection_metadata(venv: t.Union['VenvRunner', 'FakeVenvRunner'], ) -> t.Dict[str, AnsibleCollectionMetadata]: collection_metadata = {} - # Obtain ansible.builtin version - if collection_names is None or 'ansible.builtin' in collection_names: - venv_ansible = venv.get_command('ansible') - ansible_version_cmd = venv_ansible('--version', _env=env) - raw_result = ansible_version_cmd.stdout.decode('utf-8', errors='surrogateescape') - collection_metadata['ansible.builtin'] = _extract_ansible_builtin_metadata(raw_result) + # Obtain ansible.builtin version and path + venv_ansible = venv.get_command('ansible') + ansible_version_cmd = venv_ansible('--version', _env=env) + raw_result = ansible_version_cmd.stdout.decode('utf-8', errors='surrogateescape') + collection_metadata['ansible.builtin'] = _extract_ansible_builtin_metadata(raw_result) # Obtain collection versions venv_ansible_galaxy = venv.get_command('ansible-galaxy') diff --git a/src/antsibull_docs/docs_parsing/parsing.py b/src/antsibull_docs/docs_parsing/parsing.py index 92456bee..a573f0b9 100644 --- a/src/antsibull_docs/docs_parsing/parsing.py +++ b/src/antsibull_docs/docs_parsing/parsing.py @@ -53,8 +53,9 @@ async def get_ansible_plugin_info(venv: t.Union['VenvRunner', 'FakeVenvRunner'], {information from ansible-doc --json. See the ansible-doc documentation for more info.} - The second component is a Mapping of collection names to metadata. - + The second component is a Mapping of collection names to metadata. The second mapping + always includes the metadata for ansible.builtin, even if it was not explicitly + mentioned in ``collection_names``. """ flog = mlog.fields(func='get_ansible_plugin_info')