mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-10-03 22:16:31 +08:00
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
This commit is contained in:
parent
18cc0685d7
commit
079b74aad1
@ -5,7 +5,7 @@ from conan.tools.files import copy, update_conandata
|
|||||||
from conan.tools.scm import Version
|
from conan.tools.scm import Version
|
||||||
from conan.errors import ConanInvalidConfiguration
|
from conan.errors import ConanInvalidConfiguration
|
||||||
|
|
||||||
required_conan_version = ">=1.58.0 <2.0.0"
|
required_conan_version = ">=2.7.0"
|
||||||
|
|
||||||
|
|
||||||
class CuraResource(ConanFile):
|
class CuraResource(ConanFile):
|
||||||
@ -15,9 +15,8 @@ class CuraResource(ConanFile):
|
|||||||
url = "https://github.com/Ultimaker/cura"
|
url = "https://github.com/Ultimaker/cura"
|
||||||
description = "Cura Resources"
|
description = "Cura Resources"
|
||||||
topics = ("conan", "cura")
|
topics = ("conan", "cura")
|
||||||
settings = "os", "compiler", "build_type", "arch"
|
|
||||||
no_copy_source = True
|
no_copy_source = True
|
||||||
|
package_type = "shared-library"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _shared_resources(self):
|
def _shared_resources(self):
|
||||||
@ -37,10 +36,6 @@ class CuraResource(ConanFile):
|
|||||||
copy(self, pattern="*", src=os.path.join(self.recipe_folder, shared_resources),
|
copy(self, pattern="*", src=os.path.join(self.recipe_folder, shared_resources),
|
||||||
dst=os.path.join(self.export_sources_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):
|
def layout(self):
|
||||||
self.cpp.source.resdirs = self._shared_resources
|
self.cpp.source.resdirs = self._shared_resources
|
||||||
self.cpp.package.resdirs = [f"res/{res}" for res in 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_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", "definitions"))
|
||||||
self.runenv_info.append_path("CURA_ENGINE_SEARCH_PATH", os.path.join(self.package_folder, "res", "extruders"))
|
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):
|
def package_id(self):
|
||||||
self.info.clear()
|
self.info.clear()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user