|
|
|
|
@ -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.module_utils.common.text.converters import to_bytes, to_native, to_text
|
|
|
|
|
@ -40,6 +40,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()
|
|
|
|
|
|
|
|
|
|
@ -236,6 +237,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.'.
|
|
|
|
|
|