summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-03-04 08:24:08 -0800
committerEli Schwartz <eschwartz93@gmail.com>2025-03-10 14:14:25 -0400
commit251f74dcf3fea706ed373b717257f82592b6a1de (patch)
tree5ee2906048dc2bb552be08e040d332e9dfc7d8fb /mesonbuild/compilers/compilers.py
parent4fa52925459dac650bf053715987ee7beb3b23c1 (diff)
downloadmeson-251f74dcf3fea706ed373b717257f82592b6a1de.tar.gz
coredata: remove get_option_for_subproject
This is just a wrapper around `OptionStore.get_option_for`, but without taking an `OptionKey`. This complicates the subproject passing, since `OptionKey` is designed to encapsulate the option name and subproject.
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index f0744f80b..a73697cdd 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -280,10 +280,12 @@ def are_asserts_disabled(target: 'BuildTarget', env: 'Environment') -> bool:
(env.coredata.get_option_for_target(target, 'b_ndebug') == 'if-release' and
env.coredata.get_option_for_target(target, 'buildtype') in {'release', 'plain'}))
+
def are_asserts_disabled_for_subproject(subproject: str, env: 'Environment') -> bool:
- return (env.coredata.get_option_for_subproject('b_ndebug', subproject) == 'true' or
- (env.coredata.get_option_for_subproject('b_ndebug', subproject) == 'if-release' and
- env.coredata.get_option_for_subproject('buildtype', subproject) in {'release', 'plain'}))
+ key = OptionKey('b_ndebug', subproject)
+ return (env.coredata.optstore.get_value_for(key) == 'true' or
+ (env.coredata.optstore.get_value_for(key) == 'if-release' and
+ env.coredata.optstore.get_value_for(key.evolve(name='buildtype')) in {'release', 'plain'}))
def get_base_compile_args(target: 'BuildTarget', compiler: 'Compiler', env: 'Environment') -> T.List[str]:
@@ -1400,7 +1402,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
if target:
return env.coredata.get_option_for_target(target, key)
else:
- return env.coredata.get_option_for_subproject(key, subproject)
+ return env.coredata.optstore.get_value_for(key.evolve(subproject=subproject))
def _update_language_stds(self, opts: MutableKeyedOptionDictType, value: T.List[str]) -> None:
key = self.form_compileropt_key('std')