From e7467b82f8717da64a542b4c4bdc3a2571e99d9e Mon Sep 17 00:00:00 2001 From: yqy Date: Thu, 21 Aug 2025 15:39:44 +0800 Subject: [PATCH 1/2] special handling for bundled collections without manifests --- lib/ansible/galaxy/dependency_resolution/dataclasses.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/galaxy/dependency_resolution/dataclasses.py b/lib/ansible/galaxy/dependency_resolution/dataclasses.py index 5fe66c16f1c..4fa390a4df6 100644 --- a/lib/ansible/galaxy/dependency_resolution/dataclasses.py +++ b/lib/ansible/galaxy/dependency_resolution/dataclasses.py @@ -25,7 +25,7 @@ if t.TYPE_CHECKING: 'Candidate', 'Requirement', '_ComputedReqKindsMixin', ) - +import ansible from ansible.errors import AnsibleError, AnsibleAssertionError from ansible.galaxy.api import GalaxyAPI from ansible.galaxy.collection import HAS_PACKAGING, PkgReq @@ -39,6 +39,7 @@ _ALLOW_CONCRETE_POINTER_IN_SOURCE = False # NOTE: This is a feature flag _GALAXY_YAML = b'galaxy.yml' _MANIFEST_JSON = b'MANIFEST.json' _SOURCE_METADATA_FILE = b'GALAXY.yml' +_ANSIBLE_PACKAGE_PATH = pathlib.Path(ansible.__file__).parent display = Display() @@ -225,6 +226,12 @@ class _ComputedReqKindsMixin: dir_path = dir_path.rstrip(to_bytes(os.path.sep)) if not _is_collection_dir(dir_path): dir_pathlib = pathlib.Path(to_text(dir_path)) + + # special handling for bundled collections without manifests, e.g., ansible._protomatter + if dir_pathlib.is_relative_to(_ANSIBLE_PACKAGE_PATH): + req_name = f'{dir_pathlib.parent.name}.{dir_pathlib.name}' + return cls(req_name, ansible.release.__version__, dir_path, 'dir', None) + display.warning( u"Collection at '{path!s}' does not have a {manifest_json!s} " u'file, nor has it {galaxy_yml!s}: cannot detect version.'. From 81ae329ad0cd814bda9e24d0eacddfa2f0da2e8a Mon Sep 17 00:00:00 2001 From: yqy Date: Thu, 21 Aug 2025 16:06:30 +0800 Subject: [PATCH 2/2] Add change log --- .../85711-handing-for-collection-without-mainifests.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelogs/fragments/85711-handing-for-collection-without-mainifests.yml diff --git a/changelogs/fragments/85711-handing-for-collection-without-mainifests.yml b/changelogs/fragments/85711-handing-for-collection-without-mainifests.yml new file mode 100644 index 00000000000..82cd66898f7 --- /dev/null +++ b/changelogs/fragments/85711-handing-for-collection-without-mainifests.yml @@ -0,0 +1,3 @@ +bugfixes: +- >- + ansible-doc - fix in the ansible-doc process error output _protomatter related Warning log(https://github.com/ansible/ansible/pull/85711).