Skip to content

Commit

Permalink
Update Conanfile to support Conan 2.x and simplify configuration
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jellespijker committed Dec 12, 2024
1 parent 18cc068 commit 079b74a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions resources/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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):
Expand All @@ -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):
Expand All @@ -37,10 +36,6 @@ def export_sources(self):
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]
Expand All @@ -54,9 +49,6 @@ def package_info(self):
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()

0 comments on commit 079b74a

Please sign in to comment.