From 3ff752f41515813384ff4f2415fafa265183c260 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Fri, 25 Oct 2024 01:42:19 +0200 Subject: [PATCH] Don't make built target available if it is missing original path, recompiled path, or recompiled pdb path --- reccmp/project/detect.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/reccmp/project/detect.py b/reccmp/project/detect.py index b9966450..9478b99c 100644 --- a/reccmp/project/detect.py +++ b/reccmp/project/detect.py @@ -179,24 +179,27 @@ def from_directory(cls, directory: Path) -> "RecCmpBuiltProject": original_path_str = user_target_data.get("path") if not original_path_str: - raise InvalidRecCmpProjectException( - f"{user_config}: targets.{target_id}.path is missing" + logger.warning( + "%s: targets.%s.path is missing. Target will not be available.", user_config, target_id ) + continue original_path = Path(original_path_str.strip()) build_target_data = build_data.get("targets", {}).get(target_id, {}) recompiled_path_str = build_target_data.get("path") if not recompiled_path_str: - raise InvalidRecCmpProjectException( - f"{build_config}: targets.{target_id}.path is missing." + logger.warning( + "%s: targets.%s.path is missing. Target will not be available.", build_config, target_id ) + continue recompiled_path = Path(recompiled_path_str) recompiled_pdb_str = build_target_data.get("pdb") if not recompiled_path_str: - raise InvalidRecCmpProjectException( - f"{build_config}: targets.{target_id}.pdb is missing." + logger.warning( + "%s: targets.%s.pdb is missing. Target will not be available.", build_config, target_id ) + continue recompiled_pdb = Path(recompiled_pdb_str) project.targets[target_id] = RecCmpBuiltTarget( @@ -355,7 +358,7 @@ def detect_project( search_path: list[Path], detect_what: DetectWhat, build_directory: typing.Optional[Path] = None, -) -> RecCmpProject: +) -> None: yaml = ruamel.yaml.YAML() project_config_path = project_directory / RECCMP_PROJECT_CONFIG @@ -432,4 +435,3 @@ def detect_project( with build_config_path.open("w") as f: yaml.dump(data=build_data, stream=f) - return 0