diff options
author | j.spijker@ultimaker.com <jelle spijker> | 2022-06-12 18:30:38 +0300 |
---|---|---|
committer | Jelle Spijker <j.spijker@ultimaker.com> | 2022-06-12 18:30:38 +0300 |
commit | e1c384cd9201aa021e9ff7cecfe5cc1e747b4f8e (patch) | |
tree | 948bb165279fee54ab26360a01a2811ceccf2a56 /conanfile.py | |
parent | 8c6a5baf355c27a29aec81221e8a256f1e630c4a (diff) |
Add a conanfile
This file should take care of downloading the C++ and Python binding
dependencies. It uses the PythonVirtualRunEnv to generate a Virtual
Python Environment, setting the Paths and installing the requirements
specified in the requirements.txt
Contributes to CURA-9365
Diffstat (limited to 'conanfile.py')
-rw-r--r-- | conanfile.py | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000000..68bd9d2c17 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,87 @@ +import os + +from platform import python_version + +from conan import ConanFile +from conans import tools +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.47.0" + + +class CuraConan(ConanFile): + name = "cura" + license = "LGPL-3.0" + author = "Ultimaker B.V." + url = "https://github.com/Ultimaker/cura" + description = "3D printer / slicing GUI built on top of the Uranium framework" + topics = ("conan", "python", "pyqt5", "qt", "qml", "3d-printing", "slicer") + build_policy = "missing" + exports = "LICENSE*" + settings = "os", "compiler", "build_type", "arch" + short_paths = True + generators = "VirtualPythonEnv" + options = { + "python_version": "ANY", + "enterprise": [True, False], + "staging": [True, False], + "external_engine": [True, False], + "devtools": [True, False] + } + default_options = { + "python_version": "system", + "enterprise": False, + "staging": False, + "external_engine": False, + "devtools": False + } + scm = { + "type": "git", + "subfolder": ".", + "url": "auto", + "revision": "auto" + } + + @property + def requirements_txts(self): + if self.options.devtools: + return ["requirements.txt", "requirements-dev.txt"] + return "requirements.txt" + + def config_options(self): + if self.options.python_version == "system": + self.options.python_version = python_version() + + def configure(self): + self.options["*"].shared = True + + def validate(self): + if self.version: + if tools.Version(self.version) <= tools.Version("4"): + raise ConanInvalidConfiguration("Only versions 5+ are support") + + def requirements(self): + self.requires("curaengine/latest@ultimaker/cura-9365") # FIXME: change to ultimaker/stable once the curaengine PR for CURA-9365 has been merged + self.requires("arcus/latest@ultimaker/cura-9365") # FIXME: change to ultimaker/stable once the arcus PR for CURA-9365 has been merged + self.requires("savitar/latest@ultimaker/cura-9365") # FIXME: change to ultimaker/stable once the savitar PR for CURA-9365 has been merged + self.requires("pynest2d/latest@ultimaker/cura-9365") # FIXME: change to ultimaker/stable once the pynest2d PR for CURA-9365 has been merged + + def generate(self): + pass + + def layout(self): + self.folders.source = "." + self.folders.build = "venv" + self.folders.generators = os.path.join(self.folders.build, "conan") + + # FIXME: Once libCharon en Uranium are also Packages + if "PYTHONPATH" in os.environ: + self.runenv_info.append_path("PYTHONPATH", os.environ["PYTHONPATH"]) + + def imports(self): + self.copy("CuraEngine.exe", root_package = "curaengine", src = "@bindirs", dst = self.source_folder, keep_path = False) + self.copy("CuraEngine", root_package = "curaengine", src = "@bindirs", dst = self.source_folder, keep_path = False) + self.copy("*.dll", src = "@bindirs", dst = os.path.join(self.folders.build, "Lib", "site-packages")) + self.copy("*.pyd", src = "@libdirs", dst = os.path.join(self.folders.build, "Lib", "site-packages")) + self.copy("*.pyi", src = "@libdirs", dst = os.path.join(self.folders.build, "Lib", "site-packages")) + self.copy("*.dylib", src = "@libdirs", dst = os.path.join(self.folders.build, "bin")) |