Skip to content

Commit

Permalink
Add cura_resources as dependency and update resource directories
Browse files Browse the repository at this point in the history
A new dependency 'cura_resources' has been added to the conandata.yml. The handling of 'cura_resources' has been updated, now including specific sections for definitions, extruders, intent, meshes, quality and variants. GitHub Actions workflows and conan scripts have been adjusted accordingly to include these changes.

Contribute to NP-186
  • Loading branch information
jellespijker committed May 6, 2024
1 parent 26c4354 commit 0942c35
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/conan-package-resources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:
- '.github/workflows/conan-package-resources.yml'
- 'resources/definitions/**'
- 'resources/extruders/**'
- 'resources/images/**'
- 'resources/intent/**'
- 'resources/meshes/**'
- 'resources/quality/**'
- 'resources/variants/**'
- 'resources/conanfile.py'
- 'resources/conandata.yml'
branches:
- 'main'
- 'CURA-*'
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/conan-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ on:
paths:
- 'plugins/**'
- 'cura/**'
- 'resources/bundled_packages/**'
- 'resources/i18n/**'
- 'resources/qml/**'
- 'resources/setting_visibility/**'
- 'resources/shaders/**'
- 'resources/texts/**'
- 'resources/themes/**'
- 'resources/public_key.pem'
- 'resources/README_resources.txt'
- 'icons/**'
- 'tests/**'
- 'packaging/**'
Expand Down
29 changes: 25 additions & 4 deletions conandata.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "5.8.0-alpha.0"
requirements:
- "cura_resources/(latest)@ultimaker/np_186"
- "uranium/(latest)@ultimaker/testing"
- "curaengine/(latest)@ultimaker/testing"
- "cura_binary_data/(latest)@ultimaker/testing"
Expand Down Expand Up @@ -50,10 +51,30 @@ pyinstaller:
package: "native_cad_plugin"
src: "res/bundled_packages"
dst: "share/cura/resources/bundled_packages"
cura_resources:
package: "cura"
src: "resources"
dst: "share/cura/resources"
cura_resources_definitions:
package: "cura_resources"
src: "definitions"
dst: "share/cura/resources/definitions"
cura_resources_extruders:
package: "cura_resources"
src: "extruders"
dst: "share/cura/resources/extruders"
cura_resources_intent:
package: "cura_resources"
src: "intent"
dst: "share/cura/resources/intent"
cura_resources_meshes:
package: "cura_resources"
src: "meshes"
dst: "share/cura/resources/meshes"
cura_resources_quality:
package: "cura_resources"
src: "quality"
dst: "share/cura/resources/quality"
cura_resources_variants:
package: "cura_resources"
src: "variants"
dst: "share/cura/resources/variants"
cura_private_data:
package: "cura_private_data"
src: "res"
Expand Down
12 changes: 12 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,12 @@ def deploy(self):
copy(self, "*", os.path.join(self.package_folder, self.cpp_info.resdirs[0]), str(self._share_dir.joinpath("cura", "resources")), keep_path = True)
copy(self, "*", os.path.join(self.package_folder, self.cpp_info.resdirs[1]), str(self._share_dir.joinpath("cura", "plugins")), keep_path = True)

# Copy the cura_resources resources from the package
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 resources of Uranium (keep folder structure)
uranium = self.dependencies["uranium"].cpp_info
copy(self, "*", uranium.resdirs[0], str(self._share_dir.joinpath("uranium", "resources")), keep_path = True)
Expand Down Expand Up @@ -519,6 +525,12 @@ def package(self):
# Remove the fdm_materials from the package
rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[0], "materials"))

# Remove the cura_resources resources from the package
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))

def package_info(self):
self.user_info.pip_requirements = "requirements.txt"
self.user_info.pip_requirements_git = "requirements-ultimaker.txt"
Expand Down
6 changes: 3 additions & 3 deletions resources/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import os
from pathlib import Path
from jinja2 import Template

from conan import ConanFile
from conan.tools.files import copy, update_conandata
Expand Down Expand Up @@ -35,6 +33,8 @@ def export_sources(self):
dst=os.path.join(self.export_sources_folder, "definitions"))
copy(self, pattern="*", src=os.path.join(self.recipe_folder, "extruders"),
dst=os.path.join(self.export_sources_folder, "extruders"))
copy(self, pattern="*", src=os.path.join(self.recipe_folder, "images"),
dst=os.path.join(self.export_sources_folder, "images"))
copy(self, pattern="*", src=os.path.join(self.recipe_folder, "intent"),
dst=os.path.join(self.export_sources_folder, "intent"))
copy(self, pattern="*", src=os.path.join(self.recipe_folder, "meshes"),
Expand All @@ -49,7 +49,7 @@ def validate(self):
raise ConanInvalidConfiguration("Only versions 5+ are support")

def layout(self):
self.cpp.source.resdirs = ["definitions", "extruders", "intent", "meshes", "quality", "variants"]
self.cpp.source.resdirs = ["definitions", "extruders", "images", "intent", "meshes", "quality", "variants"]

def package(self):
copy(self, "*", os.path.join(self.export_sources_folder),
Expand Down

0 comments on commit 0942c35

Please sign in to comment.