Update resource directories in Conanfile

Resource directories in the Conanfile have been updated to include full resource paths and also preserve the original directory structure when copying. The 'keep_path' option has been set to true to maintain the original path structure during the copying process.

Contribute to NP-186
This commit is contained in:
Jelle Spijker 2024-05-06 13:11:52 +02:00
parent 0942c35c0a
commit 9824c5703c
No known key found for this signature in database
GPG key ID: 0E9129B3096F4E72
2 changed files with 3 additions and 2 deletions

View file

@ -472,7 +472,7 @@ class CuraConan(ConanFile):
rm(self, "conanfile.py", os.path.join(self.package_folder, self.cpp.package.resdirs[0]))
cura_resources = self.dependencies["cura_resources"].cpp_info
for res_dir in cura_resources.resdirs:
copy(self, "*", res_dir, str(self._share_dir.joinpath("cura", "resources", res_dir)))
copy(self, "*", res_dir, str(self._share_dir.joinpath("cura", "resources", Path(res_dir).name)), keep_path = True)
# Copy resources of Uranium (keep folder structure)
uranium = self.dependencies["uranium"].cpp_info
@ -529,7 +529,7 @@ echo "CURA_APP_NAME={{ cura_app_name }}" >> ${{ env_prefix }}GITHUB_ENV
rm(self, "conanfile.py", os.path.join(self.package_folder, self.cpp.package.resdirs[0]))
cura_resources = self.dependencies["cura_resources"].cpp_info
for res_dir in cura_resources.resdirs:
rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[0], res_dir))
rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[0], Path(res_dir).name))
def package_info(self):
self.user_info.pip_requirements = "requirements.txt"

View file

@ -50,6 +50,7 @@ class CuraResource(ConanFile):
def layout(self):
self.cpp.source.resdirs = ["definitions", "extruders", "images", "intent", "meshes", "quality", "variants"]
self.cpp.package.resdirs = ["res/definitions", "res/extruders", "res/images", "res/intent", "res/meshes", "res/quality", "res/variants"]
def package(self):
copy(self, "*", os.path.join(self.export_sources_folder),