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

Allow library configs to override target configs #6658

Merged
merged 3 commits into from Apr 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 9 additions & 11 deletions tools/config/__init__.py
Expand Up @@ -117,7 +117,7 @@ def get_full_name(name, unit_name, unit_kind, label=None,
unit_name, unit_kind, label)))
prefix = temp[0]
# Check if the given parameter prefix matches the expected prefix
if (unit_kind == "library" and prefix != unit_name) or \
if (unit_kind == "library" and prefix not in [unit_name, "target"]) or \
(unit_kind == "target" and prefix != "target"):
raise ConfigException(
"Invalid prefix '%s' for parameter name '%s' in '%s'" %
Expand Down Expand Up @@ -857,21 +857,20 @@ def get_target_config_data(self):
params[full_name].set_value(val, tname, "target")
return params

def get_lib_config_data(self):
def get_lib_config_data(self, target_data):
""" Read and interpret configuration data defined by libraries. It is
assumed that "add_config_files" above was already called and the library
configuration data exists in self.lib_config_data

Arguments: None
"""
all_params, macros = {}, {}
macros = {}
for lib_name, lib_data in self.lib_config_data.items():
all_params.update(self._process_config_and_overrides(lib_data, {},
lib_name,
"library"))
self._process_config_and_overrides(
lib_data, target_data, lib_name, "library")
_process_macros(lib_data.get("macros", []), macros, lib_name,
"library")
return all_params, macros
return target_data, macros

def get_app_config_data(self, params, macros):
""" Read and interpret the configuration data defined by the target. The
Expand Down Expand Up @@ -901,10 +900,9 @@ def get_config_data(self):
Arguments: None
"""
all_params = self.get_target_config_data()
lib_params, macros = self.get_lib_config_data()
all_params.update(lib_params)
self.get_app_config_data(all_params, macros)
return all_params, macros
lib_params, macros = self.get_lib_config_data(all_params)
self.get_app_config_data(lib_params, macros)
return lib_params, macros

@staticmethod
def _check_required_parameters(params):
Expand Down