-
Notifications
You must be signed in to change notification settings - Fork 47
lopper:assists:baremetal_getsupported_comp_xlnx: Add support to inclu… #552
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
Conversation
Hi @onkarharsh and @kedareswararao |
@@ -46,7 +75,7 @@ def xlnx_baremetal_getsupported_comp(tgt_node, sdt, options): | |||
|
|||
matched_node = get_cpu_node(sdt, options) | |||
proc_ip_name = matched_node['xlnx,ip-name'].value[0] | |||
|
|||
family = sdt.tree.dct['family'][0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to use propval() if possible, that takes care of exceptions as well..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used propval() as suggested
bd38fef
to
2394fdc
Compare
try: | ||
exec(examples["condition"], {}, local_scope) | ||
except Exception as e: | ||
_error("The condition in the YAML file has failed. -> {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this as a warning, not an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added warning as suggested
exec(examples["condition"], {}, local_scope) | ||
except Exception as e: | ||
_error("The condition in the YAML file has failed. -> {e}") | ||
examples = {key: value for key, value in examples.items() if key in local_scope["examples"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this examples under try block. If the condition fails, the old flow should still continue working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated code as suggested
except Exception as e: | ||
_error("The condition in the YAML file has failed. -> {e}") | ||
examples = {key: value for key, value in examples.items() if key in local_scope["examples"]} | ||
for ex,deps in examples.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete "condition" key from examples before this loop to make old flow work.
@@ -46,7 +75,7 @@ def xlnx_baremetal_getsupported_comp(tgt_node, sdt, options): | |||
|
|||
matched_node = get_cpu_node(sdt, options) | |||
proc_ip_name = matched_node['xlnx,ip-name'].value[0] | |||
|
|||
family = sdt.tree['/'].propval('family')[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the presence of index 0 element before processing,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added few more comments, please check.
2394fdc
to
0221107
Compare
examples = {key: value for key, value in examples.items() if key in local_scope["examples"]} | ||
except Exception as e: | ||
_warning(f"The condition in the {yaml_file} file has failed. -> {e}") | ||
examples = {key: value for key, value in examples.items() if key != "condition"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
examples.pop("condition", None) ?
…de the examples in the lib_list.yaml In the current implementation the examples are not included in the lib_list yaml file, Add support to include the examples in the lib_list.yaml to show the available examles for the library in the GUI. To enhance functionality, add support for reading examples from custom configurations in YAML files. If a YAML file contains a condition within the examples section in the form of a Python code block, read and execute this code to update the examples based on the specified conditions. This approach allows dynamic configuration adjustments based on predefined logic, improving flexibility and customization in managing examples Signed-off-by: Sathish Kumar Kamishettigari <sathishkumar.kamishettigari@amd.com>
0221107
to
dceb74a
Compare
Updated the code as suggested |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final version looks fine.
…de the examples in the lib_list.yaml
In the current implementation the examples are not included in the lib_list yaml file, Add support to include the examples in the lib_list.yaml to show the available examles for the library in the GUI. To enhance functionality, add support for reading examples from custom configurations in YAML files. If a YAML file contains a condition within the examples section in the form of a Python code block, read and execute this code to update the examples based on the specified conditions. This approach allows dynamic configuration adjustments based on predefined logic, improving flexibility and customization in managing examples