diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-12-04 17:01:45 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-01-04 12:20:58 -0800 |
commit | e81acbd6069e8c1ae8e3be7bb83ddc239009d42d (patch) | |
tree | b08545b2844650ed95e42ade00ecb1cd3fb85b88 /mesonbuild/environment.py | |
parent | 71db6b04a31707674ad776be1cf22f667056d56b (diff) | |
download | meson-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/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 3ea078a..59675ff 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -640,6 +640,7 @@ class Environment: # interfaces which talk about native and cross. self.options = {k.as_host(): v for k, v in self.options.items()} + ## "freeze" now initialized configuration, and "save" to the class. self.machines = machines.default_missing() @@ -938,7 +939,7 @@ class Environment: elif isinstance(comp_class.LINKER_PREFIX, list): check_args = comp_class.LINKER_PREFIX + ['/logo'] + comp_class.LINKER_PREFIX + ['--version'] - check_args += self.coredata.compiler_options[OptionKey('args', lang=comp_class.language, machine=for_machine)].value + check_args += self.coredata.options[OptionKey('args', lang=comp_class.language, machine=for_machine)].value override = [] # type: T.List[str] value = self.lookup_binary_entry(for_machine, comp_class.language + '_ld') @@ -1004,7 +1005,7 @@ class Environment: """ self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self) extra_args = extra_args or [] - extra_args += self.coredata.compiler_options[OptionKey('args', lang=comp_class.language, machine=for_machine)].value + extra_args += self.coredata.options[OptionKey('args', lang=comp_class.language, machine=for_machine)].value if isinstance(comp_class.LINKER_PREFIX, str): check_args = [comp_class.LINKER_PREFIX + '--version'] + extra_args @@ -2009,25 +2010,25 @@ class Environment: return self.get_libdir() def get_prefix(self) -> str: - return self.coredata.get_builtin_option('prefix') + return self.coredata.get_option(OptionKey('prefix')) def get_libdir(self) -> str: - return self.coredata.get_builtin_option('libdir') + return self.coredata.get_option(OptionKey('libdir')) def get_libexecdir(self) -> str: - return self.coredata.get_builtin_option('libexecdir') + return self.coredata.get_option(OptionKey('libexecdir')) def get_bindir(self) -> str: - return self.coredata.get_builtin_option('bindir') + return self.coredata.get_option(OptionKey('bindir')) def get_includedir(self) -> str: - return self.coredata.get_builtin_option('includedir') + return self.coredata.get_option(OptionKey('includedir')) def get_mandir(self) -> str: - return self.coredata.get_builtin_option('mandir') + return self.coredata.get_option(OptionKey('mandir')) def get_datadir(self) -> str: - return self.coredata.get_builtin_option('datadir') + return self.coredata.get_option(OptionKey('datadir')) def get_compiler_system_dirs(self, for_machine: MachineChoice): for comp in self.coredata.compilers[for_machine].values(): |