From b229eb291ea027346087e1e2de11aac6657c4187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Ram=C3=ADrez?= Date: Tue, 9 Apr 2024 20:02:30 +0200 Subject: [PATCH] (#23433) wayland-protocols: Change `datadir` into relative folder (Conan 1.64 & 2.2.0) * Using relative folder instead (conan required version) * Using dict-like type instead * Update conanfile.py * Backward compatible --- recipes/wayland-protocols/all/conanfile.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/recipes/wayland-protocols/all/conanfile.py b/recipes/wayland-protocols/all/conanfile.py index ad20a22df526e..9302d46b476a0 100644 --- a/recipes/wayland-protocols/all/conanfile.py +++ b/recipes/wayland-protocols/all/conanfile.py @@ -1,4 +1,4 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.env import VirtualBuildEnv from conan.tools.files import copy, get, replace_in_file, rmdir from conan.tools.layout import basic_layout @@ -7,7 +7,7 @@ from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.64.0 <2 || >=2.2.0" class WaylandProtocolsConan(ConanFile): @@ -38,7 +38,8 @@ def source(self): def generate(self): tc = MesonToolchain(self) - tc.project_options["datadir"] = os.path.join(self.package_folder, "res") + # Using relative folder because of this https://github.com/conan-io/conan/pull/15706 + tc.project_options["datadir"] = "res" tc.project_options["tests"] = "false" tc.generate() virtual_build_env = VirtualBuildEnv(self) @@ -68,10 +69,10 @@ def package_info(self): 'datarootdir': '${prefix}/res', 'pkgdatadir': '${datarootdir}/wayland-protocols', } - self.cpp_info.set_property( - "pkg_config_custom_content", - "\n".join(f"{key}={value}" for key,value in pkgconfig_variables.items())) - + # TODO: Remove when Conan 1.x not supported + pkgconfig_variables = pkgconfig_variables if conan_version.major >= 2 \ + else "\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items()) + self.cpp_info.set_property("pkg_config_custom_content", pkgconfig_variables) self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] self.cpp_info.bindirs = []