Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't make built target available if it is missing original path, recompiled path, or recompiled pdb path #9

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading