Skip to content

Commit

Permalink
Don't make built target available if it is missing original path, rec…
Browse files Browse the repository at this point in the history
…ompiled path, or recompiled pdb path
  • Loading branch information
madebr committed Oct 24, 2024
1 parent 6256cb0 commit 3a2e082
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
24 changes: 16 additions & 8 deletions reccmp/project/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,24 +179,33 @@ 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(
Expand Down Expand Up @@ -355,7 +364,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
Expand Down Expand Up @@ -432,4 +441,3 @@ def detect_project(

with build_config_path.open("w") as f:
yaml.dump(data=build_data, stream=f)
return 0
3 changes: 1 addition & 2 deletions reccmp/tools/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def main():
f"Cannot find reccmp project. Run '{parser.prog} create' first."
)
try:
# pylint: disable=unused-argument
project = detect_project(
detect_project(
project_directory=project.project_config_path.parent,
search_path=args.detect_search_path,
detect_what=args.detect_what,
Expand Down

0 comments on commit 3a2e082

Please sign in to comment.