From 9b223ef0e0290cf7a37ee2563160f6cd4cc60b8f Mon Sep 17 00:00:00 2001 From: Daniel Richard G Date: Fri, 8 Mar 2024 15:47:25 -0500 Subject: [PATCH 1/3] Don't break on empty patch list for version in conandata.yml (#15841) --- conan/tools/files/patches.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conan/tools/files/patches.py b/conan/tools/files/patches.py index d3e48d62f53..2add350bac5 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.info("apply_conandata_patches(): No patches defined for version in conandata") + 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.info("export_conandata_patches(): No patches defined for version in conandata") + return elif isinstance(patches, list): entries = patches else: From 6cb54b09cf7775b93add66d50ed35652f2a77895 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 11 Mar 2024 08:29:17 +0100 Subject: [PATCH 2/3] Update conan/tools/files/patches.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rubén Rincón Blanco --- conan/tools/files/patches.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conan/tools/files/patches.py b/conan/tools/files/patches.py index 2add350bac5..b296c48ff2e 100644 --- a/conan/tools/files/patches.py +++ b/conan/tools/files/patches.py @@ -131,7 +131,7 @@ def export_conandata_patches(conanfile): assert conanfile.version, "Can only be exported if conanfile.version is already defined" entries = patches.get(conanfile.version, []) if entries is None: - conanfile.output.info("export_conandata_patches(): No patches defined for version in conandata") + conanfile.output.warning(f"export_conandata_patches(): No patches defined for version {conanfile.version} in conandata.yml") return elif isinstance(patches, list): entries = patches From e3892184057606927c9cab3a76501118d6c8bb7d Mon Sep 17 00:00:00 2001 From: James Date: Mon, 11 Mar 2024 08:29:24 +0100 Subject: [PATCH 3/3] Update conan/tools/files/patches.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Rubén Rincón Blanco --- conan/tools/files/patches.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conan/tools/files/patches.py b/conan/tools/files/patches.py index b296c48ff2e..f3274f83f62 100644 --- a/conan/tools/files/patches.py +++ b/conan/tools/files/patches.py @@ -89,7 +89,7 @@ def apply_conandata_patches(conanfile): 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.info("apply_conandata_patches(): No patches defined for version in conandata") + conanfile.output.warning(f"apply_conandata_patches(): No patches defined for version {conanfile.version} in conandata.yml") return elif isinstance(patches, list): entries = patches