From 4fedf332a09162829cdd8e4f472f631c473e5347 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Wed, 13 Nov 2024 16:22:03 +0100 Subject: [PATCH] Raise exceptions on critical errors --- conandata.yml | 12 ++++++------ conanfile.py | 15 +++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/conandata.yml b/conandata.yml index d1fd19af9f..77b6469f78 100644 --- a/conandata.yml +++ b/conandata.yml @@ -38,13 +38,13 @@ pyinstaller: src: "plugins" dst: "share/cura/plugins" native_cad_plugin: - package: "native_cad_plugin" - src: "res/plugins/NativeCADplugin" - dst: "share/cura/plugins/NativeCADplugin" + package: "native_cad_plugin" + src: "res/plugins/NativeCADplugin" + dst: "share/cura/plugins/NativeCADplugin" native_cad_plugin_bundled: - package: "native_cad_plugin" - src: "res/bundled_packages" - dst: "share/cura/resources/bundled_packages" + package: "native_cad_plugin" + src: "res/bundled_packages" + dst: "share/cura/resources/bundled_packages" cura_resources: package: "cura" src: "resources" diff --git a/conanfile.py b/conanfile.py index e59dc1eb9c..b1280385b3 100644 --- a/conanfile.py +++ b/conanfile.py @@ -207,9 +207,12 @@ class CuraConan(ConanFile): 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(): - datas.append((str(src_path), data["dst"])) + raise ConanException("Misformatted conan data for pyinstaller datas, expected either package or root option") + + if not Path(src_path).exists(): + raise ConanException(f"Missing folder {src_path} for pyinstaller data {data}") + + datas.append((str(src_path), data["dst"])) binaries = [] for binary in pyinstaller_metadata["binaries"].values(): @@ -220,10 +223,10 @@ class CuraConan(ConanFile): if self.settings.os == "Windows": src_path = src_path.replace("\\", "\\\\") else: - continue + raise ConanException("Misformatted conan data for pyinstaller binaries, expected either package or root option") + if not Path(src_path).exists(): - self.output.warning(f"Source path for binary {binary['binary']} does not exist") - continue + raise ConanException(f"Missing folder {src_path} for pyinstaller binary {binary}") for bin in Path(src_path).glob(binary["binary"] + "*[.exe|.dll|.so|.dylib|.so.]*"): binaries.append((str(bin), binary["dst"]))