Просмотр исходного кода

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
Jelle Spijker 10 месяцев назад
Родитель
Сommit
9824c5703c
2 измененных файлов с 3 добавлено и 2 удалено
  1. 2 2
      conanfile.py
  2. 1 0
      resources/conanfile.py

+ 2 - 2
conanfile.py

@@ -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"

+ 1 - 0
resources/conanfile.py

@@ -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),