From dc48ad1ec44fc783de3361d6b14f8a20148f200f Mon Sep 17 00:00:00 2001 From: Keith Chow Date: Mon, 15 Jun 2020 09:08:27 -0400 Subject: [PATCH] Fixed duplicate support in rh create and xml_parsing of numeric booleans for variables --- converter/lib/create_xmls.py | 5 +++-- converter/lib/xml_parsing.py | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/converter/lib/create_xmls.py b/converter/lib/create_xmls.py index 2162cf4..fe6427e 100644 --- a/converter/lib/create_xmls.py +++ b/converter/lib/create_xmls.py @@ -52,7 +52,8 @@ def formatSCD(rp, ports): for si in supports_list: all_interfaces.add_interface(scd.interface(repid=si.id, name=si.name, inheritsinterface=si.inherits)) - sup_interfaces.add_supportsinterface(scd.supportsInterface(repid=si.id, supportsname=si.name)) + # 2020-June-15 - Deactivate redundant support list + #sup_interfaces.add_supportsinterface(scd.supportsInterface(repid=si.id, supportsname=si.name)) for interface in all_interfaces.get_interface(): if "Resource" in interface.name: @@ -116,7 +117,7 @@ def formatPRF(rp, props, docker_image, docker_volumes): for i in range(0, len(props)): new_id = "gr::" + props[i].name new_name = "gr_" + props[i].name - rp.addSimpleProperty(id=new_id, value=props[i].value, complex=False, type=props[i].type, kindtypes=["property"]) + rp.addSimpleProperty(id=new_id, value=str(props[i].value), complex=False, type=props[i].type, kindtypes=["property"]) rp.prf.simple[i].set_name(new_name) def docker_execparam(name, value, description): diff --git a/converter/lib/xml_parsing.py b/converter/lib/xml_parsing.py index 542296d..2745f32 100644 --- a/converter/lib/xml_parsing.py +++ b/converter/lib/xml_parsing.py @@ -37,10 +37,23 @@ def from_xml(block): param_key = param.find('key').text.lower() param_value = param.find('value').text - if param_key == "_enabled" and "true" != param_value.lower(): - # Skip disabled blocks - # EARLY RETURN - return None + """ + 2020-06-15 + Swap to support numeric booleans + Tested with GNU Radio 3.7.14 + """ + #if param_key == "_enabled" and "true" != param_value.lower(): + # # Skip disabled blocks + # # EARLY RETURN + # return None + if param_key == "_enabled": + if param_value.lower() == "true": + continue # enabled with true + elif param_value.lower() in ["false", "none"]: + return None # disabled with false or None + elif not bool(int(param_value)): + return None # disabled component, return None + # Map other known keys to fields or treat any unknowns as possible # references to variable IDs (if the key starts with an alpha char) elif param_key == "id":