Raise exceptions on critical errors

This commit is contained in:
Erwan MATHIEU 2024-11-13 16:22:03 +01:00
parent 85644b621e
commit 4fedf332a0
2 changed files with 15 additions and 12 deletions

View File

@ -207,8 +207,11 @@ class CuraConan(ConanFile):
elif "root" in data: # get the paths relative from the install folder elif "root" in data: # get the paths relative from the install folder
src_path = os.path.join(self.install_folder, data["root"], data["src"]) src_path = os.path.join(self.install_folder, data["root"], data["src"])
else: else:
continue raise ConanException("Misformatted conan data for pyinstaller datas, expected either package or root option")
if Path(src_path).exists():
if not Path(src_path).exists():
raise ConanException(f"Missing folder {src_path} for pyinstaller data {data}")
datas.append((str(src_path), data["dst"])) datas.append((str(src_path), data["dst"]))
binaries = [] binaries = []
@ -220,10 +223,10 @@ class CuraConan(ConanFile):
if self.settings.os == "Windows": if self.settings.os == "Windows":
src_path = src_path.replace("\\", "\\\\") src_path = src_path.replace("\\", "\\\\")
else: else:
continue raise ConanException("Misformatted conan data for pyinstaller binaries, expected either package or root option")
if not Path(src_path).exists(): if not Path(src_path).exists():
self.output.warning(f"Source path for binary {binary['binary']} does not exist") raise ConanException(f"Missing folder {src_path} for pyinstaller binary {binary}")
continue
for bin in Path(src_path).glob(binary["binary"] + "*[.exe|.dll|.so|.dylib|.so.]*"): for bin in Path(src_path).glob(binary["binary"] + "*[.exe|.dll|.so|.dylib|.so.]*"):
binaries.append((str(bin), binary["dst"])) binaries.append((str(bin), binary["dst"]))