Browse Source

Merge remote-tracking branch 'origin/main' into CURA-10415_main_based_update_tree

# Conflicts:
#	resources/i18n/cs_CZ/fdmprinter.def.json.po
#	resources/i18n/de_DE/fdmprinter.def.json.po
#	resources/i18n/es_ES/fdmprinter.def.json.po
#	resources/i18n/fdmprinter.def.json.pot
#	resources/i18n/fi_FI/fdmprinter.def.json.po
#	resources/i18n/fr_FR/fdmprinter.def.json.po
#	resources/i18n/hu_HU/fdmprinter.def.json.po
#	resources/i18n/it_IT/fdmprinter.def.json.po
#	resources/i18n/ja_JP/fdmprinter.def.json.po
#	resources/i18n/ko_KR/fdmprinter.def.json.po
#	resources/i18n/nl_NL/fdmprinter.def.json.po
#	resources/i18n/pl_PL/fdmprinter.def.json.po
#	resources/i18n/pt_BR/fdmprinter.def.json.po
#	resources/i18n/pt_PT/fdmprinter.def.json.po
#	resources/i18n/ru_RU/fdmprinter.def.json.po
#	resources/i18n/tr_TR/fdmprinter.def.json.po
#	resources/i18n/zh_CN/fdmprinter.def.json.po
#	resources/i18n/zh_TW/fdmprinter.def.json.po
Jelle Spijker 1 year ago
parent
commit
59d0fb68ea

+ 11 - 7
.github/workflows/conan-package-create.yml

@@ -51,10 +51,8 @@ on:
                 type: boolean
 
 env:
-    CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
-    CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
-    CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
-    CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
+    CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }}
+    CONAN_PASSWORD: ${{ secrets.CONAN_PASS }}
     CONAN_LOG_RUN_TO_OUTPUT: 1
     CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
     CONAN_NON_INTERACTIVE: 1
@@ -145,10 +143,16 @@ jobs:
                 if: ${{ inputs.conan_config_branch == '' }}
                 run: conan config install https://github.com/Ultimaker/conan-config.git
 
+            -   name: Add Cura private Artifactory remote
+                run: conan remote add cura-private https://ultimaker.jfrog.io/artifactory/api/conan/cura-private True
+
             -   name: Create the Packages
                 run: conan install ${{ inputs.recipe_id_full }} --build=missing --update
 
             -   name: Upload the Package(s)
-                if: always()
-                run: |
-                    conan upload ${{ inputs.recipe_id_full }} -r cura --all -c
+                if: ${{ always() && inputs.conan_upload_community }}
+                run: conan upload ${{ inputs.recipe_id_full }} -r cura --all -c
+
+            -   name: Upload the Package(s) to the private Artifactory
+                if: ${{ always() && ! inputs.conan_upload_community }}
+                run: conan upload ${{ inputs.recipe_id_full }} -r cura-private --all -c

+ 12 - 5
.github/workflows/conan-recipe-export.yml

@@ -37,10 +37,8 @@ on:
                 type: boolean
 
 env:
-    CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
-    CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
-    CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
-    CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
+    CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }}
+    CONAN_PASSWORD: ${{ secrets.CONAN_PASS }}
     CONAN_LOG_RUN_TO_OUTPUT: 1
     CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
     CONAN_NON_INTERACTIVE: 1
@@ -80,6 +78,9 @@ jobs:
                 if: ${{ inputs.conan_config_branch == '' }}
                 run: conan config install https://github.com/Ultimaker/conan-config.git
 
+            -   name: Add Cura private Artifactory remote
+                run: conan remote add cura-private https://ultimaker.jfrog.io/artifactory/api/conan/cura-private True
+
             -   name: Export the Package (binaries)
                 if: ${{ inputs.conan_export_binaries }}
                 run: conan create . ${{ inputs.recipe_id_full }} --build=missing --update
@@ -93,7 +94,13 @@ jobs:
                 run: conan alias ${{ inputs.recipe_id_latest }} ${{ inputs.recipe_id_full }}
 
             -   name: Upload the Package(s)
-                if: always()
+                if: ${{ always() && inputs.conan_upload_community }}
                 run: |
                     conan upload ${{ inputs.recipe_id_full }} -r cura --all -c
                     conan upload ${{ inputs.recipe_id_latest }} -r cura -c
+
+            -   name: Upload the Package(s) to the private Artifactory
+                if: ${{ always() && ! inputs.conan_upload_community }}
+                run: |
+                    conan upload ${{ inputs.recipe_id_full }} -r cura-private --all -c
+                    conan upload ${{ inputs.recipe_id_latest }} -r cura-private -c

+ 1 - 1
.github/workflows/conan-recipe-version.yml

@@ -183,7 +183,7 @@ jobs:
                                     try:
                                         if "remotes/origin" in branch.abspath:
                                             b_version = Version(branch.name.split("/")[-1])
-                                            if b_version < Version("10.0.0") and b_version > max_branches_version:
+                                            if b_version <  Version("6.0.0") and b_version > max_branches_version:
                                                 max_branches_version = b_version
                                                 branches_no_commits = repo.commit().count() - branch.commit.count()
                                     except:

+ 71 - 0
.github/workflows/security_badge.yml

@@ -0,0 +1,71 @@
+# NOTE: Best to keep all of these remarks in, they might prove useful in the future.
+#       This is basically just the standard one that is sugested on 'new workflow'.
+
+name: Scorecard supply-chain security
+on:
+  # For Branch-Protection check. Only the default branch is supported. See
+  # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
+  branch_protection_rule:
+  # To guarantee Maintained check is occasionally updated. See
+  # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
+  schedule:
+    - cron: '25 2 * * 5'
+  push:
+    branches: [ "main" ]
+
+# Declare default permissions as read only.
+permissions: read-all
+
+jobs:
+  analysis:
+    name: Scorecard analysis
+    runs-on: ubuntu-latest
+    permissions:
+      # Needed to upload the results to code-scanning dashboard.
+      security-events: write
+      # Needed to publish results and get a badge (see publish_results below).
+      id-token: write
+      # Uncomment the permissions below if installing in a private repository.
+      # contents: read
+      # actions: read
+
+    steps:
+      - name: "Checkout code"
+        uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
+        with:
+          persist-credentials: false
+
+      - name: "Run analysis"
+        uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
+        with:
+          results_file: results.sarif
+          results_format: sarif
+          # (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
+          # - you want to enable the Branch-Protection check on a *public* repository, or
+          # - you are installing Scorecard on a *private* repository
+          # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
+          # repo_token: ${{ secrets.SCORECARD_TOKEN }}
+
+          # Public repositories:
+          #   - Publish results to OpenSSF REST API for easy access by consumers
+          #   - Allows the repository to include the Scorecard badge.
+          #   - See https://github.com/ossf/scorecard-action#publishing-results.
+          # For private repositories:
+          #   - `publish_results` will always be set to `false`, regardless
+          #     of the value entered here.
+          publish_results: true
+
+      # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
+      # format to the repository Actions tab.
+      - name: "Upload artifact"
+        uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
+        with:
+          name: SARIF file
+          path: results.sarif
+          retention-days: 5
+
+      # Upload the results to GitHub's code scanning dashboard.
+      - name: "Upload to code-scanning"
+        uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
+        with:
+          sarif_file: results.sarif

+ 1 - 1
.github/workflows/unit-test-post.yml

@@ -79,4 +79,4 @@ jobs:
                     files: "tests/**/*.xml"
 
             -   name: Conclusion
-                run: echo "Conclusion is ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}"
+                run: echo "Conclusion is ${{ steps.test-results.outputs.json && fromJSON( steps.test-results.outputs.json ).conclusion }}"

+ 1 - 0
.gitignore

@@ -31,6 +31,7 @@ LC_MESSAGES
 .directory
 .idea
 cura.desktop
+*.bak
 
 # Eclipse+PyDev
 .project

+ 3 - 0
README.md

@@ -57,6 +57,9 @@
 
 <br>
 
+[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/Ultimaker/Cura/badge)](https://api.securityscorecards.dev/projects/github.com/Ultimaker/Cura)
+
+<br>
 
 <!----------------------------------------------------------------------------->
 

+ 16 - 3
conandata.yml

@@ -1,3 +1,16 @@
+urls:
+    default:
+        cloud_api_root: "https://api.ultimaker.com"
+        cloud_account_api_root: "https://account.ultimaker.com"
+        marketplace_root: "https://marketplace.ultimaker.com"
+        digital_factory_url: "https://digitalfactory.ultimaker.com"
+        cura_latest_url: "https://software.ultimaker.com/latest.json"
+    staging:
+        cloud_api_root: "https://api-staging.ultimaker.com"
+        cloud_account_api_root: "https://account-staging.ultimaker.com"
+        marketplace_root: "https://marketplace-staging.ultimaker.com"
+        digital_factory_url: "https://digitalfactory-staging.ultimaker.com"
+        cura_latest_url: "https://software.ultimaker.com/latest.json"
 pyinstaller:
     runinfo:
         entrypoint: "cura_app.py"
@@ -12,8 +25,8 @@ pyinstaller:
             dst: "share/cura/resources"
         cura_private_data:
             package: "cura_private_data"
-            src: "resources"
-            dst: "share/cura/resources"
+            src: "res"
+            dst: "share/cura"
             internal: true
         uranium_plugins:
             package: "uranium"
@@ -41,7 +54,7 @@ pyinstaller:
             dst: "share/windows"
         fdm_materials:
             package: "fdm_materials"
-            src: "materials"
+            src: "res/resources/materials"
             dst: "share/cura/resources/materials"
         tcl:
             package: "tcl"

+ 44 - 72
conanfile.py

@@ -23,7 +23,6 @@ class CuraConan(ConanFile):
     build_policy = "missing"
     exports = "LICENSE*", "UltiMaker-Cura.spec.jinja", "CuraVersion.py.jinja"
     settings = "os", "compiler", "build_type", "arch"
-    no_copy_source = True  # We won't build so no need to copy sources to the build folder
 
     # FIXME: Remove specific branch once merged to main
     python_requires = "umbase/[>=0.1.7]@ultimaker/stable", "translationextractor/[>=2.1.1]@ultimaker/stable"
@@ -49,7 +48,7 @@ class CuraConan(ConanFile):
     }
 
     def set_version(self):
-        if self.version == "auto":
+        if not self.version:
             self.version = "5.4.0-alpha"
 
     @property
@@ -74,10 +73,6 @@ class CuraConan(ConanFile):
             self._cura_env.define("QT_XKB_CONFIG_ROOT", "/usr/share/X11/xkb")
         return self._cura_env
 
-    @property
-    def _staging(self):
-        return self.options.staging in ["True", 'true']
-
     @property
     def _enterprise(self):
         return self.options.enterprise in ["True", 'true']
@@ -89,24 +84,10 @@ class CuraConan(ConanFile):
         return str(self.options.display_name)
 
     @property
-    def _cloud_api_root(self):
-        return "https://api-staging.ultimaker.com" if self._staging else "https://api.ultimaker.com"
-
-    @property
-    def _cloud_account_api_root(self):
-        return "https://account-staging.ultimaker.com" if self._staging else "https://account.ultimaker.com"
-
-    @property
-    def _marketplace_root(self):
-        return "https://marketplace-staging.ultimaker.com" if self._staging else "https://marketplace.ultimaker.com"
-
-    @property
-    def _digital_factory_url(self):
-        return "https://digitalfactory-staging.ultimaker.com" if self._staging else "https://digitalfactory.ultimaker.com"
-
-    @property
-    def _cura_latest_url(self):
-        return "https://software.ultimaker.com/latest.json"
+    def _urls(self):
+        if self.options.staging in ["True", 'true']:
+            return "staging"
+        return "default"
 
     @property
     def requirements_txts(self):
@@ -176,12 +157,12 @@ class CuraConan(ConanFile):
                 cura_version = cura_version,
                 cura_build_type = "Enterprise" if self._enterprise else "",
                 cura_debug_mode = self.options.cura_debug_mode,
-                cura_cloud_api_root = self._cloud_api_root,
+                cura_cloud_api_root = self.conan_data["urls"][self._urls]["cloud_api_root"],
                 cura_cloud_api_version = self.options.cloud_api_version,
-                cura_cloud_account_api_root = self._cloud_account_api_root,
-                cura_marketplace_root = self._marketplace_root,
-                cura_digital_factory_url = self._digital_factory_url,
-                cura_latest_url = self._cura_latest_url))
+                cura_cloud_account_api_root = self.conan_data["urls"][self._urls]["cloud_account_api_root"],
+                cura_marketplace_root = self.conan_data["urls"][self._urls]["marketplace_root"],
+                cura_digital_factory_url = self.conan_data["urls"][self._urls]["digital_factory_url"],
+                cura_latest_url = self.conan_data["urls"][self._urls]["cura_latest_url"]))
 
     def _generate_pyinstaller_spec(self, location, entrypoint_location, icon_path, entitlements_file):
         pyinstaller_metadata = self.conan_data["pyinstaller"]
@@ -274,8 +255,6 @@ class CuraConan(ConanFile):
         copy(self, "requirements.txt", self.recipe_folder, self.export_sources_folder)
         copy(self, "requirements-dev.txt", self.recipe_folder, self.export_sources_folder)
         copy(self, "requirements-ultimaker.txt", self.recipe_folder, self.export_sources_folder)
-        copy(self, "UltiMaker-Cura.spec.jinja", self.recipe_folder, self.export_sources_folder)
-        copy(self, "CuraVersion.py.jinja", self.recipe_folder, self.export_sources_folder)
         copy(self, "cura_app.py", self.recipe_folder, self.export_sources_folder)
 
     def configure(self):
@@ -295,11 +274,13 @@ class CuraConan(ConanFile):
         self.requires("pysavitar/5.2.2")
         self.requires("pynest2d/5.2.2")
         self.requires("uranium/(latest)@ultimaker/testing")
-        self.requires("fdm_materials/(latest)@{}/testing".format("internal" if self.options.internal else "ultimaker"))
         self.requires("cura_binary_data/(latest)@ultimaker/testing")
         self.requires("cpython/3.10.4")
         if self.options.internal:
             self.requires("cura_private_data/(latest)@ultimaker/testing")
+            self.requires("fdm_materials/(latest)@internal/testing")
+        else:
+            self.requires("fdm_materials/(latest)@ultimaker/testing")
 
     def build_requirements(self):
         if self.options.devtools:
@@ -380,63 +361,54 @@ class CuraConan(ConanFile):
 
     def deploy(self):
         # Copy CuraEngine.exe to bindirs of Virtual Python Environment
-        # TODO: Fix source such that it will get the curaengine relative from the executable (Python bindir in this case)
-        self.copy_deps("CuraEngine.exe", root_package = "curaengine", src = self.deps_cpp_info["curaengine"].bindirs[0],
-                       dst = self._base_dir,
-                       keep_path = False)
-        self.copy_deps("CuraEngine", root_package = "curaengine", src = self.deps_cpp_info["curaengine"].bindirs[0], dst = self._base_dir,
-                       keep_path = False)
+        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 resources of Cura (keep folder structure)
-        self.copy("*", src = self.cpp_info.bindirs[0], dst = self._base_dir, keep_path = False)
-        self.copy("*", src = self.cpp_info.libdirs[0], dst = self._site_packages.joinpath("cura"), keep_path = True)
-        self.copy("*", src = self.cpp_info.resdirs[0], dst = self._share_dir.joinpath("cura", "resources"), keep_path = True)
-        self.copy("*", src = self.cpp_info.resdirs[1], dst = self._share_dir.joinpath("cura", "plugins"), keep_path = True)
+        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)
-        self.copy_deps("*.fdm_material", root_package = "fdm_materials", src = self.deps_cpp_info["fdm_materials"].resdirs[0],
-                       dst = self._share_dir.joinpath("cura", "resources", "materials"), keep_path = False)
-        self.copy_deps("*.sig", root_package = "fdm_materials", src = self.deps_cpp_info["fdm_materials"].resdirs[0],
-                       dst = self._share_dir.joinpath("cura", "resources", "materials"), keep_path = False)
+        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:
-            self.copy_deps("*", root_package = "cura_private_data", src = self.deps_cpp_info["cura_private_data"].resdirs[0],
-                           dst = self._share_dir.joinpath("cura", "resources"), keep_path = True)
-            self.copy_deps("*", root_package = "cura_private_data", src = self.deps_cpp_info["cura_private_data"].resdirs[1],
-                           dst = self._share_dir.joinpath("cura", "plugins"), keep_path = True)
+            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)
-        self.copy_deps("*", root_package = "uranium", src = self.deps_cpp_info["uranium"].resdirs[0],
-                       dst = self._share_dir.joinpath("uranium", "resources"), keep_path = True)
-        self.copy_deps("*", root_package = "uranium", src = self.deps_cpp_info["uranium"].resdirs[1],
-                       dst = self._share_dir.joinpath("uranium", "plugins"), keep_path = True)
-        self.copy_deps("*", root_package = "uranium", src = self.deps_cpp_info["uranium"].libdirs[0],
-                       dst = self._site_packages.joinpath("UM"),
-                       keep_path = True)
-        self.copy_deps("*", root_package = "uranium", src = str(os.path.join(self.deps_cpp_info["uranium"].libdirs[0], "Qt", "qml", "UM")),
-                       dst = self._site_packages.joinpath("PyQt6", "Qt6", "qml", "UM"),
-                       keep_path = True)
+        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
-        self.copy_deps("*", root_package = "cura_binary_data", src = self.deps_cpp_info["cura_binary_data"].resdirs[0],
-                       dst = self._share_dir.joinpath("cura"), keep_path = True)
-        self.copy_deps("*", root_package = "cura_binary_data", src = self.deps_cpp_info["cura_binary_data"].resdirs[1],
-                       dst = self._share_dir.joinpath("uranium"), keep_path = True)
+        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":
-            self.copy_deps("*", root_package = "cura_binary_data", src = self.deps_cpp_info["cura_binary_data"].resdirs[2],
-                           dst = self._share_dir.joinpath("windows"), keep_path = True)
+            copy(self, "*", cura_binary_data.resdirs[2], str(self._share_dir.joinpath("windows")), keep_path = True)
 
-        self.copy_deps("*.dll", src = "@bindirs", dst = self._site_packages)
-        self.copy_deps("*.pyd", src = "@libdirs", dst = self._site_packages)
-        self.copy_deps("*.pyi", src = "@libdirs", dst = self._site_packages)
-        self.copy_deps("*.dylib", src = "@libdirs", dst = self._base_dir.joinpath("lib"))
+        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
-        self.copy("*", src = self.cpp_info.resdirs[2], dst = self._base_dir.joinpath("packaging"))
+        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
-        self.copy("*.txt", src = self.cpp_info.resdirs[-1], dst = self._base_dir.joinpath("pip_requirements"))
+        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)

+ 1 - 1
cura/CuraApplication.py

@@ -130,7 +130,7 @@ class CuraApplication(QtApplication):
     # SettingVersion represents the set of settings available in the machine/extruder definitions.
     # You need to make sure that this version number needs to be increased if there is any non-backwards-compatible
     # changes of the settings.
-    SettingVersion = 21
+    SettingVersion = 22
 
     Created = False
 

Some files were not shown because too many files changed in this diff