aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/optinterpreter.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-12-04 17:01:45 -0800
committerDylan Baker <dylan@pnwbakers.com>2021-01-04 12:20:58 -0800
commite81acbd6069e8c1ae8e3be7bb83ddc239009d42d (patch)
treeb08545b2844650ed95e42ade00ecb1cd3fb85b88 /mesonbuild/optinterpreter.py
parent71db6b04a31707674ad776be1cf22f667056d56b (diff)
downloadmeson-e81acbd6069e8c1ae8e3be7bb83ddc239009d42d.zip
meson-e81acbd6069e8c1ae8e3be7bb83ddc239009d42d.tar.gz
meson-e81acbd6069e8c1ae8e3be7bb83ddc239009d42d.tar.bz2
Use a single coredata dictionary for options
This patches takes the options work to it's logical conclusion: A single flat dictionary of OptionKey: UserOptions. This allows us to simplify a large number of cases, as we don't need to check if an option is in this dict or that one (or any of 5 or 6, actually).
Diffstat (limited to 'mesonbuild/optinterpreter.py')
-rw-r--r--mesonbuild/optinterpreter.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index 0b18f7e..dc8c3ce 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -137,7 +137,7 @@ option_types = {'string': string_parser,
class OptionInterpreter:
def __init__(self, subproject: str) -> None:
- self.options: T.Dict[str, coredata.UserOption] = {}
+ self.options: 'coredata.KeyedOptionDictType' = {}
self.subproject = subproject
def process(self, option_file: str) -> None:
@@ -227,8 +227,7 @@ class OptionInterpreter:
raise OptionException('Option names can only contain letters, numbers or dashes.')
if is_invalid_name(opt_name):
raise OptionException('Option name %s is reserved.' % opt_name)
- if self.subproject != '':
- opt_name = self.subproject + ':' + opt_name
+ key = mesonlib.OptionKey(opt_name, self.subproject)
if 'yield' in kwargs:
FeatureNew.single_use('option yield', '0.45.0', self.subproject)
@@ -248,4 +247,4 @@ class OptionInterpreter:
opt = option_types[opt_type](opt_name, description, kwargs)
if opt.description == '':
opt.description = opt_name
- self.options[opt_name] = opt
+ self.options[key] = opt