Browse Source

Use umbase 0.1.7

This will now set the version by default if not
defined at the cmd line to the first entry in the
conandata.yml
jelle Spijker 2 years ago
parent
commit
59d9bfde99
2 changed files with 16 additions and 117 deletions
  1. 1 106
      conandata.yml
  2. 15 11
      conanfile.py

+ 1 - 106
conandata.yml

@@ -1,5 +1,5 @@
 ---
-# Usage: defaults to None
+# Usage: defaults to the first entry in this conandata.yml file
 # If you're on a release branch create an entry for that **version**  e.q.: `5.1.0` update the requirements (use pinned versions, not latest)
 # also create a beta entry for that **version**  e.q.: `5.1.0-beta`, update the requirements (use the <dep_name>/(latest)@ultimaker/stable)
 #
@@ -10,111 +10,6 @@
 # requirements (use the <dep_name>/(latest)@ultimaker/testing)
 #
 # Subject to change in the future!
-"None":
-    requirements:
-        - "pyarcus/(latest)@ultimaker/testing"
-        - "curaengine/(latest)@ultimaker/testing"
-        - "pysavitar/(latest)@ultimaker/testing"
-        - "pynest2d/(latest)@ultimaker/testing"
-        - "uranium/(latest)@ultimaker/testing"
-        - "fdm_materials/(latest)@ultimaker/testing"
-        - "cura_binary_data/(latest)@ultimaker/testing"
-        - "cpython/3.10.4"
-    internal_requirements:
-        - "fdm_materials_private/(latest)@ultimaker/testing"
-        - "cura_private_data/(latest)@ultimaker/testing"
-    runinfo:
-        entrypoint: "cura_app.py"
-    pyinstaller:
-        datas:
-            cura_plugins:
-                package: "cura"
-                src: "plugins"
-                dst: "share/cura/plugins"
-            cura_resources:
-                package: "cura"
-                src: "resources"
-                dst: "share/cura/resources"
-            cura_private_data:
-                package: "cura_private_data"
-                src: "resources"
-                dst: "share/cura/resources"
-                internal: true
-            uranium_plugins:
-                package: "uranium"
-                src: "plugins"
-                dst: "share/uranium/plugins"
-            uranium_resources:
-                package: "uranium"
-                src: "resources"
-                dst: "share/uranium/resources"
-            uranium_um_qt_qml_um:
-                package: "uranium"
-                src: "site-packages/UM/Qt/qml/UM"
-                dst: "PyQt6/Qt6/qml/UM"
-            cura_binary_data:
-                package: "cura_binary_data"
-                src: "resources/cura/resources"
-                dst: "share/cura/resources"
-            uranium_binary_data:
-                package: "cura_binary_data"
-                src: "resources/uranium/resources"
-                dst: "share/uranium/resources"
-            windows_binary_data:
-                package: "cura_binary_data"
-                src: "windows"
-                dst: "share/windows"
-            fdm_materials:
-                package: "fdm_materials"
-                src: "materials"
-                dst: "share/cura/resources/materials"
-            fdm_materials_private:
-                package: "fdm_materials_private"
-                src: "resources/materials"
-                dst: "share/cura/resources/materials"
-                internal: true
-            tcl:
-                package: "tcl"
-                src: "lib/tcl8.6"
-                dst: "tcl"
-            tk:
-                package: "tk"
-                src: "lib/tk8.6"
-                dst: "tk"
-        binaries:
-            curaengine:
-                package: "curaengine"
-                src: "bin"
-                dst: "."
-                binary: "CuraEngine"
-        hiddenimports:
-            - "pySavitar"
-            - "pyArcus"
-            - "pynest2d"
-            - "PyQt6"
-            - "PyQt6.QtNetwork"
-            - "PyQt6.sip"
-            - "logging.handlers"
-            - "zeroconf"
-            - "fcntl"
-            - "stl"
-            - "serial"
-        collect_all:
-            - "cura"
-            - "UM"
-            - "serial"
-            - "Charon"
-            - "sqlite3"
-            - "trimesh"
-            - "win32ctypes"
-            - "PyQt6"
-            - "PyQt6.QtNetwork"
-            - "PyQt6.sip"
-            - "stl"
-        icon:
-            Windows: "./icons/Cura.ico"
-            Macos: "./icons/cura.icns"
-            Linux: "./icons/cura-128.png"
 "5.2.0-alpha":
     requirements:
         - "pyarcus/(latest)@ultimaker/testing"

+ 15 - 11
conanfile.py

@@ -3,13 +3,13 @@ from pathlib import Path
 
 from jinja2 import Template
 
-from conans import tools
 from conan import ConanFile
-from conan.tools import files
+from conan.tools.files import copy, rmdir, save
 from conan.tools.env import VirtualRunEnv, Environment
+from conan.tools.scm import Version
 from conan.errors import ConanInvalidConfiguration
 
-required_conan_version = ">=1.48.0"
+required_conan_version = ">=1.50.0"
 
 
 class CuraConan(ConanFile):
@@ -26,7 +26,7 @@ class CuraConan(ConanFile):
 
     # FIXME: Remove specific branch once merged to main
     # Extending the conanfile with the UMBaseConanfile https://github.com/Ultimaker/conan-ultimaker-index/tree/CURA-9177_Fix_CI_CD/recipes/umbase
-    python_requires = "umbase/0.1.5@ultimaker/testing"
+    python_requires = "umbase/[>=0.1.7]@ultimaker/stable"
     python_requires_extend = "umbase.UMBaseConanfile"
 
     options = {
@@ -135,7 +135,7 @@ class CuraConan(ConanFile):
     def _site_packages(self):
         if self.settings.os == "Windows":
             return self._base_dir.joinpath("Lib", "site-packages")
-        py_version = tools.Version(self.deps_cpp_info["cpython"].version)
+        py_version = Version(self.deps_cpp_info["cpython"].version)
         return self._base_dir.joinpath("lib", f"python{py_version.major}.{py_version.minor}", "site-packages")
 
     @property
@@ -151,7 +151,7 @@ class CuraConan(ConanFile):
 
         cura_version = self.version
         if self.options.internal:
-            version = tools.Version(self.version)
+            version = Version(self.version)
             cura_version = f"{version.major}.{version.minor}.{version.patch}-{version.prerelease.replace('+', '+internal_')}"
 
         with open(Path(location, "CuraVersion.py"), "w") as f:
@@ -220,7 +220,7 @@ class CuraConan(ConanFile):
         with open(Path(__file__).parent.joinpath("Ultimaker-Cura.spec.jinja"), "r") as f:
             pyinstaller = Template(f.read())
 
-        cura_version = tools.Version(self.version) if self.version else tools.Version("0.0.0")
+        cura_version = Version(self.version) if self.version else Version("0.0.0")
 
         with open(Path(location, "Ultimaker-Cura.spec"), "w") as f:
             f.write(pyinstaller.render(
@@ -243,6 +243,10 @@ class CuraConan(ConanFile):
                 short_version = f"'{cura_version.major}.{cura_version.minor}.{cura_version.patch}'",
             ))
 
+    def set_version(self):
+        if self.version is None:
+            self.version = self._umdefault_version()
+
     def configure(self):
         self.options["pyarcus"].shared = True
         self.options["pysavitar"].shared = True
@@ -250,7 +254,7 @@ class CuraConan(ConanFile):
         self.options["cpython"].shared = True
 
     def validate(self):
-        if self.version and tools.Version(self.version) <= tools.Version("4"):
+        if self.version and Version(self.version) <= Version("4"):
             raise ConanInvalidConfiguration("Only versions 5+ are support")
 
     def requirements(self):
@@ -293,7 +297,7 @@ class CuraConan(ConanFile):
         self.copy("CuraEngine.exe", root_package = "curaengine", src = "@bindirs", dst = "", keep_path = False)
         self.copy("CuraEngine", root_package = "curaengine", src = "@bindirs", dst = "", keep_path = False)
 
-        files.rmdir(self, "resources/materials")
+        rmdir(self, os.path.join(self.source_folder, "resources", "materials"))
         self.copy("*.fdm_material", root_package = "fdm_materials", src = "@resdirs", dst = "resources/materials", keep_path = False)
         self.copy("*.sig", root_package = "fdm_materials", src = "@resdirs", dst = "resources/materials", keep_path = False)
 
@@ -377,7 +381,7 @@ class CuraConan(ConanFile):
         self.copy("*.txt", src = self.cpp_info.resdirs[-1], dst = self._base_dir.joinpath("pip_requirements"))
 
         # Generate the GitHub Action version info Environment
-        cura_version = tools.Version(self.version)
+        cura_version = Version(self.version)
         env_prefix = "Env:" if self.settings.os == "Windows" else ""
         activate_github_actions_version_env = Template(r"""echo "CURA_VERSION_MAJOR={{ cura_version_major }}" >> ${{ env_prefix }}GITHUB_ENV
 echo "CURA_VERSION_MINOR={{ cura_version_minor }}" >> ${{ env_prefix }}GITHUB_ENV
@@ -392,7 +396,7 @@ echo "CURA_VERSION_FULL={{ cura_version_full }}" >> ${{ env_prefix }}GITHUB_ENV
                     env_prefix = env_prefix)
 
         ext = ".sh" if self.settings.os != "Windows" else ".ps1"
-        files.save(self, self._script_dir.joinpath(f"activate_github_actions_version_env{ext}"), activate_github_actions_version_env)
+        save(self, self._script_dir.joinpath(f"activate_github_actions_version_env{ext}"), activate_github_actions_version_env)
 
         self._generate_cura_version(Path(self._site_packages, "cura"))