diff --git a/conan/tools/files/patches.py b/conan/tools/files/patches.py index d3e48d62f53..f3274f83f62 100644 --- a/conan/tools/files/patches.py +++ b/conan/tools/files/patches.py @@ -88,6 +88,9 @@ def apply_conandata_patches(conanfile): if isinstance(patches, dict): assert conanfile.version, "Can only be applied if conanfile.version is already defined" entries = patches.get(str(conanfile.version), []) + if entries is None: + conanfile.output.warning(f"apply_conandata_patches(): No patches defined for version {conanfile.version} in conandata.yml") + return elif isinstance(patches, list): entries = patches else: @@ -127,6 +130,9 @@ def export_conandata_patches(conanfile): if isinstance(patches, dict): assert conanfile.version, "Can only be exported if conanfile.version is already defined" entries = patches.get(conanfile.version, []) + if entries is None: + conanfile.output.warning(f"export_conandata_patches(): No patches defined for version {conanfile.version} in conandata.yml") + return elif isinstance(patches, list): entries = patches else: