From 079b74aad1082432302435c8b9c68d8c3ff5cd75 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Thu, 12 Dec 2024 08:28:52 +0100 Subject: [PATCH] Update Conanfile to support Conan 2.x and simplify configuration Updated the required Conan version to 2.7.0 and removed outdated validation logic and redundant environment variable setup. Simplified the configuration by defining `package_type` and streamlining resource-related definitions. These changes align with Conan 2.x improvements and modernize the recipe. Contribute to NP-637 --- resources/conanfile.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/resources/conanfile.py b/resources/conanfile.py index fde648eeac..aea89f4569 100644 --- a/resources/conanfile.py +++ b/resources/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.files import copy, update_conandata from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.58.0 <2.0.0" +required_conan_version = ">=2.7.0" class CuraResource(ConanFile): @@ -15,9 +15,8 @@ class CuraResource(ConanFile): url = "https://github.com/Ultimaker/cura" description = "Cura Resources" topics = ("conan", "cura") - settings = "os", "compiler", "build_type", "arch" no_copy_source = True - + package_type = "shared-library" @property def _shared_resources(self): @@ -37,10 +36,6 @@ class CuraResource(ConanFile): copy(self, pattern="*", src=os.path.join(self.recipe_folder, shared_resources), dst=os.path.join(self.export_sources_folder, shared_resources)) - def validate(self): - if Version(self.version) <= Version("4"): - raise ConanInvalidConfiguration("Only versions 5+ are support") - def layout(self): self.cpp.source.resdirs = self._shared_resources self.cpp.package.resdirs = [f"res/{res}" for res in self._shared_resources] @@ -54,9 +49,6 @@ class CuraResource(ConanFile): self.runenv_info.append_path("CURA_RESOURCES", os.path.join(self.package_folder, "res")) self.runenv_info.append_path("CURA_ENGINE_SEARCH_PATH", os.path.join(self.package_folder, "res", "definitions")) self.runenv_info.append_path("CURA_ENGINE_SEARCH_PATH", os.path.join(self.package_folder, "res", "extruders")) - self.env_info.CURA_RESOURCES.append(os.path.join(self.package_folder, "res")) - self.env_info.CURA_ENGINE_SEARCH_PATH.append(os.path.join(self.package_folder, "res", "definitions")) - self.env_info.CURA_ENGINE_SEARCH_PATH.append(os.path.join(self.package_folder, "res", "definitions")) def package_id(self): self.info.clear()