From a9018a06c4233132ce717bfbbecbce6141f8ec4e Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 19 Mar 2025 15:39:00 +0100 Subject: [PATCH 1/4] Have developer/tester/etc. builds be distinct per biweekly day. Less cause for confusion when sending out internal builds to test/develop on. CURA-12469 --- conanfile.py | 24 ++++++++++++++++++++++++ resources/themes/daily_test_colors.json | 16 ++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 resources/themes/daily_test_colors.json diff --git a/conanfile.py b/conanfile.py index b3e070e3b3..c727a6d293 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,8 +1,10 @@ +import json import os import requests import yaml import tempfile import tarfile +from datetime import datetime from io import StringIO from pathlib import Path from git import Repo @@ -562,6 +564,25 @@ class CuraConan(ConanFile): self.cpp.package.bindirs = ["bin"] self.cpp.package.resdirs = ["resources", "plugins", "packaging"] + def _make_internal_distinct(self): + test_colors_path = Path(self.source_folder, "resources", "themes", "daily_test_colors.json") + if self.options.internal: + biweekly_day = (datetime.now() - datetime(2025, 3, 14)).days + with test_colors_path.open("r") as test_colors_file: + test_colors = json.load(test_colors_file) + for theme_dir in Path(self.source_folder, "resources", "themes").iterdir(): + if theme_dir.is_dir(): + theme_path = Path(theme_dir, "theme.json") + if theme_path.exists(): + with theme_path.open("r") as theme_file: + theme = json.load(theme_file) + if theme["colors"]: + theme["colors"]["main_window_header_background"] = test_colors[biweekly_day] + with theme_path.open("w") as theme_file: + json.dump(theme, theme_file) + elif test_colors_path.exists(): + test_colors_path.unlink() + def generate(self): copy(self, "cura_app.py", self.source_folder, str(self._script_dir)) @@ -581,6 +602,9 @@ class CuraConan(ConanFile): copy(self, "bundled_*.json", native_cad_plugin.resdirs[1], str(Path(self.source_folder, "resources", "bundled_packages")), keep_path = False) + # Make internal versions built on different days distinct, so people don't get confused while testing. + self._make_internal_distinct() + # 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) diff --git a/resources/themes/daily_test_colors.json b/resources/themes/daily_test_colors.json new file mode 100644 index 0000000000..1cfa2baa74 --- /dev/null +++ b/resources/themes/daily_test_colors.json @@ -0,0 +1,16 @@ +[ + [ 62, 33, 55, 255], + [126, 196, 193, 255], + [126, 196, 193, 255], + [215, 155, 125, 255], + [228, 148, 58, 255], + [192, 199, 65, 255], + [157, 48, 59, 255], + [140, 143, 174, 255], + [ 23, 67, 75, 255], + [ 23, 67, 75, 255], + [154, 99, 72, 255], + [112, 55, 127, 255], + [100, 125, 52, 255], + [210, 100, 113, 255] +] From bc4d57348cc223f115e384aa0a72baa0a585ed97 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 19 Mar 2025 16:27:31 +0100 Subject: [PATCH 2/4] Version has been bumped a while ago. Needed to test CURA-12469 (and I suppose it doesn't hurt for anything else that needs the internal data). --- conandata.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conandata.yml b/conandata.yml index 50d27455a2..20392c6e44 100644 --- a/conandata.yml +++ b/conandata.yml @@ -10,7 +10,7 @@ requirements: - "pynest2d/5.10.0" requirements_internal: - "fdm_materials/5.11.0-alpha.0@ultimaker/testing" - - "cura_private_data/5.10.0-alpha.0@internal/testing" + - "cura_private_data/5.11.0-alpha.0@internal/testing" requirements_enterprise: - "native_cad_plugin/2.0.0" urls: From 2b032af13c3ed1e43baa9c706fd0c3581b544c6c Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 19 Mar 2025 16:39:37 +0100 Subject: [PATCH 3/4] Broaden the 'internal' condition a bit. Should help with testing as well. CURA-12469 --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index c727a6d293..994dfb63a4 100644 --- a/conanfile.py +++ b/conanfile.py @@ -566,7 +566,7 @@ class CuraConan(ConanFile): def _make_internal_distinct(self): test_colors_path = Path(self.source_folder, "resources", "themes", "daily_test_colors.json") - if self.options.internal: + if "alpha" in self.version: biweekly_day = (datetime.now() - datetime(2025, 3, 14)).days with test_colors_path.open("r") as test_colors_file: test_colors = json.load(test_colors_file) From fa8e4b26cf36f697a12452003e90780ab563a4aa Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 25 Mar 2025 08:46:12 +0100 Subject: [PATCH 4/4] Delete test-colors path in any case + small refactors. Less indents and more logging. part of CURA-12469 --- conanfile.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/conanfile.py b/conanfile.py index 994dfb63a4..9e1bc26239 100644 --- a/conanfile.py +++ b/conanfile.py @@ -566,22 +566,27 @@ class CuraConan(ConanFile): def _make_internal_distinct(self): test_colors_path = Path(self.source_folder, "resources", "themes", "daily_test_colors.json") + if not test_colors_path.exists(): + print(f"Could not find '{str(test_colors_path)}'. Won't generate rotating colors for alpha builds.") + return if "alpha" in self.version: biweekly_day = (datetime.now() - datetime(2025, 3, 14)).days with test_colors_path.open("r") as test_colors_file: test_colors = json.load(test_colors_file) for theme_dir in Path(self.source_folder, "resources", "themes").iterdir(): - if theme_dir.is_dir(): - theme_path = Path(theme_dir, "theme.json") - if theme_path.exists(): - with theme_path.open("r") as theme_file: - theme = json.load(theme_file) - if theme["colors"]: - theme["colors"]["main_window_header_background"] = test_colors[biweekly_day] - with theme_path.open("w") as theme_file: - json.dump(theme, theme_file) - elif test_colors_path.exists(): - test_colors_path.unlink() + if not theme_dir.is_dir(): + continue + theme_path = Path(theme_dir, "theme.json") + if not theme_path.exists(): + print(f"('Colorize-by-day' alpha builds): Skipping {str(theme_path)}, could not find file.") + continue + with theme_path.open("r") as theme_file: + theme = json.load(theme_file) + if theme["colors"]: + theme["colors"]["main_window_header_background"] = test_colors[biweekly_day] + with theme_path.open("w") as theme_file: + json.dump(theme, theme_file) + test_colors_path.unlink() def generate(self): copy(self, "cura_app.py", self.source_folder, str(self._script_dir))