summaryrefslogtreecommitdiff
path: root/buildstream/_options/optionpool.py
diff options
context:
space:
mode:
authorValentin David <valentin.david@codethink.co.uk>2018-07-18 12:29:40 +0200
committerTiago Gomes <tiago.gomes@codethink.co.uk>2018-08-03 12:54:33 +0100
commitf47b80c37e625280c37731f57a8b2f12fc7eac79 (patch)
treee07474bf4040550d1995adb5621ed9d881267605 /buildstream/_options/optionpool.py
parent054112e270c369910a6d81b8dc90ae0f2cd4e24d (diff)
downloadbuildstream-f47b80c37e625280c37731f57a8b2f12fc7eac79.tar.gz
Add support for include '(@)' in project.conf and .bst files
Fixes #331.
Diffstat (limited to 'buildstream/_options/optionpool.py')
-rw-r--r--buildstream/_options/optionpool.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/buildstream/_options/optionpool.py b/buildstream/_options/optionpool.py
index f90fd820c..b53e87a3d 100644
--- a/buildstream/_options/optionpool.py
+++ b/buildstream/_options/optionpool.py
@@ -107,16 +107,19 @@ class OptionPool():
#
# Args:
# cli_options (list): A list of (str, str) tuples
+ # ignore_unknown (bool): Whether to silently ignore unknown options.
#
- def load_cli_values(self, cli_options):
+ def load_cli_values(self, cli_options, *, ignore_unknown=False):
for option_name, option_value in cli_options:
try:
option = self._options[option_name]
except KeyError as e:
- raise LoadError(LoadErrorReason.INVALID_DATA,
- "Unknown option '{}' specified on the command line"
- .format(option_name)) from e
- option.set_value(option_value)
+ if not ignore_unknown:
+ raise LoadError(LoadErrorReason.INVALID_DATA,
+ "Unknown option '{}' specified on the command line"
+ .format(option_name)) from e
+ else:
+ option.set_value(option_value)
# resolve()
#