summaryrefslogtreecommitdiff
path: root/buildstream
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2017-11-09 11:04:46 +0100
committerJürg Billeter <j@bitron.ch>2017-11-30 15:08:07 +0000
commitd58d12e337697a02d74a51fdd9414928d9858b9c (patch)
treef13d23201afd769ca45a436b53e238ff22ee3657 /buildstream
parent840e587e88bd85945beb8fd717ce12913b694297 (diff)
downloadbuildstream-d58d12e337697a02d74a51fdd9414928d9858b9c.tar.gz
_options/optionpool.py: Split load_values
Split load_values into load_yaml_values and load_cli_values to allow independent loading from multiple YAML nodes.
Diffstat (limited to 'buildstream')
-rw-r--r--buildstream/_options/optionpool.py17
-rw-r--r--buildstream/_project.py3
2 files changed, 14 insertions, 6 deletions
diff --git a/buildstream/_options/optionpool.py b/buildstream/_options/optionpool.py
index 90a404bfb..41990ce4a 100644
--- a/buildstream/_options/optionpool.py
+++ b/buildstream/_options/optionpool.py
@@ -74,17 +74,15 @@ class OptionPool():
option = opt_type(option_name, option_definition, self)
self.options[option_name] = option
- # load_values()
+ # load_yaml_values()
#
# Loads the option values specified in a key/value
- # dictionary loaded from YAML, and a list of tuples
- # collected from the command line
+ # dictionary loaded from YAML
#
# Args:
# node (dict): The loaded YAML options
- # cli_options (list): A list of (str, str) tuples
#
- def load_values(self, node, cli_options):
+ def load_yaml_values(self, node):
for option_name, _ in _yaml.node_items(node):
try:
option = self.options[option_name]
@@ -94,6 +92,15 @@ class OptionPool():
"{}: Unknown option '{}' specified".format(p, option_name))
option.load_value(node)
+ # load_cli_values()
+ #
+ # Loads the option values specified in a list of tuples
+ # collected from the command line
+ #
+ # Args:
+ # cli_options (list): A list of (str, str) tuples
+ #
+ def load_cli_values(self, cli_options):
for option_name, option_value in cli_options:
try:
option = self.options[option_name]
diff --git a/buildstream/_project.py b/buildstream/_project.py
index 3a4bf97f3..957bcf263 100644
--- a/buildstream/_project.py
+++ b/buildstream/_project.py
@@ -152,7 +152,8 @@ class Project():
# Collect option values specified in the user configuration
overrides = self._context._get_overrides(self.name)
override_options = _yaml.node_get(overrides, Mapping, 'options', default_value={})
- self._options.load_values(override_options, self._context._cli_options)
+ self._options.load_yaml_values(override_options)
+ self._options.load_cli_values(self._context._cli_options)
# We're done modifying options, now we can use them for substitutions
self._options.resolve()