|
@@ -4,7 +4,7 @@ from pathlib import Path
|
|
|
from jinja2 import Template
|
|
|
|
|
|
from conan import ConanFile
|
|
|
-from conan.tools.files import copy, rmdir, save, mkdir
|
|
|
+from conan.tools.files import copy, rmdir, save, mkdir, rm
|
|
|
from conan.tools.microsoft import unix_path
|
|
|
from conan.tools.env import VirtualRunEnv, Environment, VirtualBuildEnv
|
|
|
from conan.tools.scm import Version
|
|
@@ -21,12 +21,11 @@ class CuraConan(ConanFile):
|
|
|
description = "3D printer / slicing GUI built on top of the Uranium framework"
|
|
|
topics = ("conan", "python", "pyqt6", "qt", "qml", "3d-printing", "slicer")
|
|
|
build_policy = "missing"
|
|
|
- exports = "LICENSE*", "UltiMaker-Cura.spec.jinja", "CuraVersion.py.jinja", "AboutDialogVersionsList.qml.jinja"
|
|
|
+ exports = "LICENSE*", "*.jinja"
|
|
|
settings = "os", "compiler", "build_type", "arch"
|
|
|
|
|
|
# FIXME: Remove specific branch once merged to main
|
|
|
- python_requires = "umbase/[>=0.1.7]@ultimaker/stable", "translationextractor/[>=2.1.1]@ultimaker/stable"
|
|
|
- python_requires_extend = "umbase.UMBaseConanfile"
|
|
|
+ python_requires = "translationextractor/[>=2.1.1]@ultimaker/stable"
|
|
|
|
|
|
options = {
|
|
|
"enterprise": ["True", "False", "true", "false"], # Workaround for GH Action passing boolean as lowercase string
|
|
@@ -210,8 +209,8 @@ class CuraConan(ConanFile):
|
|
|
src_path = os.path.join(self.source_folder, data["src"])
|
|
|
else:
|
|
|
src_path = os.path.join(self.deps_cpp_info[data["package"]].rootpath, data["src"])
|
|
|
- elif "root" in data: # get the paths relative from the sourcefolder
|
|
|
- src_path = os.path.join(self.source_folder, data["root"], data["src"])
|
|
|
+ elif "root" in data: # get the paths relative from the install folder
|
|
|
+ src_path = os.path.join(self.install_folder, data["root"], data["src"])
|
|
|
else:
|
|
|
continue
|
|
|
if Path(src_path).exists():
|
|
@@ -222,7 +221,9 @@ class CuraConan(ConanFile):
|
|
|
if "package" in binary: # get the paths from conan package
|
|
|
src_path = os.path.join(self.deps_cpp_info[binary["package"]].rootpath, binary["src"])
|
|
|
elif "root" in binary: # get the paths relative from the sourcefolder
|
|
|
- src_path = os.path.join(self.source_folder, binary["root"], binary["src"])
|
|
|
+ src_path = str(self.source_path.joinpath(binary["root"], binary["src"]))
|
|
|
+ if self.settings.os == "Windows":
|
|
|
+ src_path = src_path.replace("\\", "\\\\")
|
|
|
else:
|
|
|
continue
|
|
|
if not Path(src_path).exists():
|
|
@@ -294,6 +295,8 @@ class CuraConan(ConanFile):
|
|
|
self.options["pynest2d"].shared = True
|
|
|
self.options["cpython"].shared = True
|
|
|
self.options["boost"].header_only = True
|
|
|
+ if self.settings.os == "Linux":
|
|
|
+ self.options["curaengine_grpc_definitions"].shared = True
|
|
|
|
|
|
def validate(self):
|
|
|
version = self.conf_info.get("user.cura:version", default = self.version, check_type = str)
|
|
@@ -302,10 +305,13 @@ class CuraConan(ConanFile):
|
|
|
|
|
|
def requirements(self):
|
|
|
self.requires("boost/1.82.0")
|
|
|
- self.requires("pyarcus/(latest)@ultimaker/cura_10951")
|
|
|
+ self.requires("curaengine_grpc_definitions/latest@ultimaker/testing")
|
|
|
+ self.requires("zlib/1.2.13")
|
|
|
+ self.requires("pyarcus/5.3.0")
|
|
|
self.requires("curaengine/(latest)@ultimaker/testing")
|
|
|
- self.requires("pysavitar/(latest)@ultimaker/cura_10951")
|
|
|
- self.requires("pynest2d/(latest)@ultimaker/cura_10951")
|
|
|
+ self.requires("pysavitar/5.3.0")
|
|
|
+ self.requires("pynest2d/5.3.0")
|
|
|
+ self.requires("curaengine_plugin_gradual_flow/(latest)@ultimaker/testing")
|
|
|
self.requires("uranium/(latest)@ultimaker/testing")
|
|
|
self.requires("cura_binary_data/(latest)@ultimaker/testing")
|
|
|
self.requires("cpython/3.10.4")
|
|
@@ -348,30 +354,39 @@ class CuraConan(ConanFile):
|
|
|
copy(self, "CuraEngine.exe", curaengine.bindirs[0], self.source_folder, keep_path = False)
|
|
|
copy(self, "CuraEngine", curaengine.bindirs[0], self.source_folder, keep_path = False)
|
|
|
|
|
|
- # Copy resources of cura_binary_data
|
|
|
- cura_binary_data = self.dependencies["cura_binary_data"].cpp_info
|
|
|
- copy(self, "*", cura_binary_data.resdirs[0], str(self._share_dir.joinpath("cura")), keep_path = True)
|
|
|
- copy(self, "*", cura_binary_data.resdirs[1], str(self._share_dir.joinpath("uranium")), keep_path = True)
|
|
|
- if self.settings.os == "Windows":
|
|
|
- copy(self, "*", cura_binary_data.resdirs[2], str(self._share_dir.joinpath("windows")), keep_path = True)
|
|
|
-
|
|
|
- for dependency in self.dependencies.host.values():
|
|
|
- for bindir in dependency.cpp_info.bindirs:
|
|
|
- copy(self, "*.dll", bindir, str(self._site_packages), keep_path = False)
|
|
|
- for libdir in dependency.cpp_info.libdirs:
|
|
|
- copy(self, "*.pyd", libdir, str(self._site_packages), keep_path = False)
|
|
|
- copy(self, "*.pyi", libdir, str(self._site_packages), keep_path = False)
|
|
|
- copy(self, "*.dylib", libdir, str(self._base_dir.joinpath("lib")), keep_path = False)
|
|
|
-
|
|
|
- # Copy materials (flat)
|
|
|
- rmdir(self, os.path.join(self.source_folder, "resources", "materials"))
|
|
|
- fdm_materials = self.dependencies["fdm_materials"].cpp_info
|
|
|
- copy(self, "*", fdm_materials.resdirs[0], self.source_folder)
|
|
|
-
|
|
|
- # Copy internal resources
|
|
|
- if self.options.internal:
|
|
|
- cura_private_data = self.dependencies["cura_private_data"].cpp_info
|
|
|
- copy(self, "*", cura_private_data.resdirs[0], str(self._share_dir.joinpath("cura")))
|
|
|
+ # Copy the external plugins that we want to bundle with Cura
|
|
|
+ rmdir(self,str(self.source_path.joinpath("plugins", "CuraEngineGradualFlow")))
|
|
|
+ curaengine_plugin_gradual_flow = self.dependencies["curaengine_plugin_gradual_flow"].cpp_info
|
|
|
+ copy(self, "*.py", curaengine_plugin_gradual_flow.resdirs[0], str(self.source_path.joinpath("plugins", "CuraEngineGradualFlow")), keep_path = True)
|
|
|
+ ext = ".exe" if self.settings.os == "Windows" else ""
|
|
|
+ copy(self, f"curaengine_plugin_gradual_flow{ext}", curaengine_plugin_gradual_flow.resdirs[0], str(self.source_path.joinpath("plugins", "CuraEngineGradualFlow")), keep_path = True)
|
|
|
+ copy(self, "*.json", curaengine_plugin_gradual_flow.resdirs[0], str(self.source_path.joinpath("plugins", "CuraEngineGradualFlow")), keep_path = True)
|
|
|
+ copy(self, "bundled_*.json", curaengine_plugin_gradual_flow.resdirs[1], str(self.source_path.joinpath("resources", "bundled_packages")), keep_path = False)
|
|
|
+
|
|
|
+ # Copy resources of cura_binary_data
|
|
|
+ cura_binary_data = self.dependencies["cura_binary_data"].cpp_info
|
|
|
+ copy(self, "*", cura_binary_data.resdirs[0], str(self._share_dir.joinpath("cura")), keep_path = True)
|
|
|
+ copy(self, "*", cura_binary_data.resdirs[1], str(self._share_dir.joinpath("uranium")), keep_path = True)
|
|
|
+ if self.settings.os == "Windows":
|
|
|
+ copy(self, "*", cura_binary_data.resdirs[2], str(self._share_dir.joinpath("windows")), keep_path = True)
|
|
|
+
|
|
|
+ for dependency in self.dependencies.host.values():
|
|
|
+ for bindir in dependency.cpp_info.bindirs:
|
|
|
+ copy(self, "*.dll", bindir, str(self._site_packages), keep_path = False)
|
|
|
+ for libdir in dependency.cpp_info.libdirs:
|
|
|
+ copy(self, "*.pyd", libdir, str(self._site_packages), keep_path = False)
|
|
|
+ copy(self, "*.pyi", libdir, str(self._site_packages), keep_path = False)
|
|
|
+ copy(self, "*.dylib", libdir, str(self._base_dir.joinpath("lib")), keep_path = False)
|
|
|
+
|
|
|
+ # Copy materials (flat)
|
|
|
+ rmdir(self, os.path.join(self.source_folder, "resources", "materials"))
|
|
|
+ fdm_materials = self.dependencies["fdm_materials"].cpp_info
|
|
|
+ copy(self, "*", fdm_materials.resdirs[0], self.source_folder)
|
|
|
+
|
|
|
+ # Copy internal resources
|
|
|
+ if self.options.internal:
|
|
|
+ cura_private_data = self.dependencies["cura_private_data"].cpp_info
|
|
|
+ copy(self, "*", cura_private_data.resdirs[0], str(self._share_dir.joinpath("cura")))
|
|
|
|
|
|
if self.options.devtools:
|
|
|
entitlements_file = "'{}'".format(os.path.join(self.source_folder, "packaging", "MacOS", "cura.entitlements"))
|
|
@@ -402,56 +417,20 @@ class CuraConan(ConanFile):
|
|
|
self.run(f"{cpp_info.bindirs[0]}/msgfmt {po_file} -o {mo_file} -f", env="conanbuild", ignore_errors=True)
|
|
|
|
|
|
def deploy(self):
|
|
|
- # Copy CuraEngine.exe to bindirs of Virtual Python Environment
|
|
|
- curaengine = self.dependencies["curaengine"].cpp_info
|
|
|
- copy(self, "CuraEngine.exe", curaengine.bindirs[0], str(self._base_dir), keep_path = False)
|
|
|
- copy(self, "CuraEngine", curaengine.bindirs[0], str(self._base_dir), keep_path = False)
|
|
|
+ copy(self, "*", os.path.join(self.package_folder, self.cpp.package.resdirs[2]), os.path.join(self.install_folder, "packaging"), keep_path = True)
|
|
|
|
|
|
- # Copy resources of Cura (keep folder structure)
|
|
|
+ # Copy resources of Cura (keep folder structure) needed by pyinstaller to determine the module structure
|
|
|
copy(self, "*", os.path.join(self.package_folder, self.cpp_info.bindirs[0]), str(self._base_dir), keep_path = False)
|
|
|
copy(self, "*", os.path.join(self.package_folder, self.cpp_info.libdirs[0]), str(self._site_packages.joinpath("cura")), keep_path = True)
|
|
|
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 materials (flat)
|
|
|
- fdm_materials = self.dependencies["fdm_materials"].cpp_info
|
|
|
- copy(self, "*", fdm_materials.resdirs[0], str(self._share_dir.joinpath("cura")))
|
|
|
-
|
|
|
- # Copy internal resources
|
|
|
- if self.options.internal:
|
|
|
- cura_private_data = self.dependencies["cura_private_data"].cpp_info
|
|
|
- copy(self, "*", cura_private_data.resdirs[0], str(self._share_dir.joinpath("cura")))
|
|
|
-
|
|
|
# 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)
|
|
|
copy(self, "*", uranium.resdirs[1], str(self._share_dir.joinpath("uranium", "plugins")), keep_path = True)
|
|
|
copy(self, "*", uranium.libdirs[0], str(self._site_packages.joinpath("UM")), keep_path = True)
|
|
|
|
|
|
- # TODO: figure out if this is still needed
|
|
|
- copy(self, "*", os.path.join(uranium.libdirs[0], "Qt", "qml", "UM"), str(self._site_packages.joinpath("PyQt6", "Qt6", "qml", "UM")), keep_path = True)
|
|
|
-
|
|
|
- # Copy resources of cura_binary_data
|
|
|
- cura_binary_data = self.dependencies["cura_binary_data"].cpp_info
|
|
|
- copy(self, "*", cura_binary_data.resdirs[0], str(self._share_dir.joinpath("cura")), keep_path = True)
|
|
|
- copy(self, "*", cura_binary_data.resdirs[1], str(self._share_dir.joinpath("uranium")), keep_path = True)
|
|
|
- if self.settings.os == "Windows":
|
|
|
- copy(self, "*", cura_binary_data.resdirs[2], str(self._share_dir.joinpath("windows")), keep_path = True)
|
|
|
-
|
|
|
- for dependency in self.dependencies.host.values():
|
|
|
- for bindir in dependency.cpp_info.bindirs:
|
|
|
- copy(self, "*.dll", bindir, str(self._site_packages), keep_path = False)
|
|
|
- for libdir in dependency.cpp_info.libdirs:
|
|
|
- copy(self, "*.pyd", libdir, str(self._site_packages), keep_path = False)
|
|
|
- copy(self, "*.pyi", libdir, str(self._site_packages), keep_path = False)
|
|
|
- copy(self, "*.dylib", libdir, str(self._base_dir.joinpath("lib")), keep_path = False)
|
|
|
-
|
|
|
- # Copy packaging scripts
|
|
|
- copy(self, "*", os.path.join(self.package_folder, self.cpp_info.resdirs[2]), str(self._base_dir.joinpath("packaging")), keep_path = True)
|
|
|
-
|
|
|
- # Copy requirements.txt's
|
|
|
- copy(self, "*.txt", os.path.join(self.package_folder, self.cpp_info.resdirs[-1]), str(self._base_dir.joinpath("pip_requirements")), keep_path = False)
|
|
|
-
|
|
|
# Generate the GitHub Action version info Environment
|
|
|
version = self.conf_info.get("user.cura:version", default = self.version, check_type = str)
|
|
|
cura_version = Version(version)
|
|
@@ -482,7 +461,6 @@ echo "CURA_APP_NAME={{ cura_app_name }}" >> ${{ env_prefix }}GITHUB_ENV
|
|
|
icon_path = "'{}'".format(os.path.join(self.package_folder, self.cpp_info.resdirs[2], self.conan_data["pyinstaller"]["icon"][str(self.settings.os)])).replace("\\", "\\\\"),
|
|
|
entitlements_file = entitlements_file if self.settings.os == "Macos" else "None")
|
|
|
|
|
|
-
|
|
|
def package(self):
|
|
|
copy(self, "cura_app.py", src = self.source_folder, dst = os.path.join(self.package_folder, self.cpp.package.bindirs[0]))
|
|
|
copy(self, "*", src = os.path.join(self.source_folder, "cura"), dst = os.path.join(self.package_folder, self.cpp.package.libdirs[0]))
|
|
@@ -492,6 +470,13 @@ echo "CURA_APP_NAME={{ cura_app_name }}" >> ${{ env_prefix }}GITHUB_ENV
|
|
|
copy(self, "requirement*.txt", src = self.source_folder, dst = os.path.join(self.package_folder, self.cpp.package.resdirs[-1]))
|
|
|
copy(self, "*", src = os.path.join(self.source_folder, "packaging"), dst = os.path.join(self.package_folder, self.cpp.package.resdirs[2]))
|
|
|
|
|
|
+ # Remove the CuraEngineGradualFlow plugin from the package
|
|
|
+ rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[1], "CuraEngineGradualFlow"))
|
|
|
+ rm(self, "bundled_*.json", os.path.join(self.package_folder, self.cpp.package.resdirs[0], "bundled_packages"), recursive = False)
|
|
|
+
|
|
|
+ # Remove the fdm_materials from the package
|
|
|
+ rmdir(self, os.path.join(self.package_folder, self.cpp.package.resdirs[0], "materials"))
|
|
|
+
|
|
|
def package_info(self):
|
|
|
self.user_info.pip_requirements = "requirements.txt"
|
|
|
self.user_info.pip_requirements_git = "requirements-ultimaker.txt"
|