diff --git a/fre/yamltools/helpers.py b/fre/yamltools/helpers.py index 36fe2836a..51624a651 100644 --- a/fre/yamltools/helpers.py +++ b/fre/yamltools/helpers.py @@ -129,6 +129,13 @@ def clean_yaml(yml_dict): if kc in yml_dict.keys(): del yml_dict[kc] + # Clean up any fre_properties in the platforms + platforms = yml_dict.get('platforms', []) + if platforms: + for platform in platforms: + if "fre_properties" in platform: + del platform['fre_properties'] + # Dump cleaned dictionary back into combined yaml file #cleaned_yaml = yaml.safe_dump(yml_dict,default_flow_style=False,sort_keys=False) return yml_dict diff --git a/fre/yamltools/info_parsers/compile_info_parser.py b/fre/yamltools/info_parsers/compile_info_parser.py index 4cca5395d..70832673d 100644 --- a/fre/yamltools/info_parsers/compile_info_parser.py +++ b/fre/yamltools/info_parsers/compile_info_parser.py @@ -121,9 +121,9 @@ def combine_platforms(self, yaml_content): :param yaml_content: string of yaml information including name, platform, target, model, and compile yaml content :type yaml_content: str - :return: dictionary of yaml information including name, platform, - target, model, compile, and platform yaml content - :rtype: dict + :return: string of yaml information including name, platform, + target, model, and compile yaml content + :rtype: str """ self.mainyaml_dir = os.path.dirname(self.yml) @@ -139,12 +139,9 @@ def combine_platforms(self, yaml_content): # Combine information as strings yaml_content += platform_content - # Load string as yaml - yml = yaml.load(yaml_content, Loader = yaml.Loader) - # Return the combined string and loaded yaml fre_logger.info(f" platforms yaml: {py_path}") - return yml + return yaml_content def combine(self): """ @@ -168,19 +165,22 @@ def combine(self): # Merge compile into combined file to create updated yaml_content/yaml try: - yaml_content = self.combine_compile(yaml_content) + yaml_content = self.combine_platforms(yaml_content) except Exception as exc: - raise ValueError("ERR: Could not merge compile yaml config with model config.") from exc + raise ValueError("ERR: Could not merge platform yaml config with model config.") from exc # Merge platforms.yaml into combined file try: - full_combined = self.combine_platforms(yaml_content) + full_combined = self.combine_compile(yaml_content) except Exception as exc: - raise ValueError("ERR: Could not merge platform yaml config with model and compile configs.") from exc + raise ValueError("ERR: Could not merge compile yaml config with model and platform configs.") from exc + + # Load string as yaml + yml = yaml.load(full_combined, Loader = yaml.Loader) # Clean the yaml try: - cleaned_yaml = clean_yaml(full_combined) + cleaned_yaml = clean_yaml(yml) except Exception as exc: raise ValueError("The final YAML could not cleaned.") from exc