rfnoc_image_builder: Fix .grc builds for empty params

Some blocks (e.g., the fosphor block) don't have parameters in their
respective YAMLs, but the GRC file importer makes the assumption that
there are always parameters, and will crash on a faulty dictionary
lookup when that's not the case. This conditionally checks parameters,
making the lack of parameters non-fatal.
This commit is contained in:
Martin Braun 2026-10-05 14:56:31 +02:00 committed by Martin Braun
parent 8ad3b4961d
commit 0cf40c3276

View File

@ -67,7 +67,7 @@ def sanitize_connection(connection, known_modules, device, grc_block_dict):
for k, v in block_info.get("data", {}).get(in_out, {}).items():
if (
port_name.startswith(k)
and (v.get("num_ports") in block_info["parameters"])
and (v.get("num_ports") in block_info.get("parameters", {}))
and port_name.endswith("_")
):
return [block_name, port_name + "0"]