summaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-08-04 19:26:42 +0200
committerDylan Baker <dylan@pnwbakers.com>2025-10-06 14:44:31 -0700
commitc6814b7cd54907128a4fb65159ed054b683157db (patch)
tree13aeaa8ca7ce57bcf60c241bdfc4f2774c27d8bc /mesonbuild
parent23828ced6810955e108aadd4ceb5fbf9c5965421 (diff)
downloadmeson-c6814b7cd54907128a4fb65159ed054b683157db.tar.gz
options: replace get_value with get_value_for
The two methods are identical. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/backend/ninjabackend.py2
-rw-r--r--mesonbuild/backend/vs2010backend.py2
-rw-r--r--mesonbuild/compilers/mixins/clike.py4
-rw-r--r--mesonbuild/compilers/mixins/emscripten.py2
-rw-r--r--mesonbuild/coredata.py4
-rw-r--r--mesonbuild/dependencies/boost.py4
-rw-r--r--mesonbuild/dependencies/pkgconfig.py2
-rw-r--r--mesonbuild/dependencies/python.py2
-rw-r--r--mesonbuild/interpreter/interpreter.py6
-rw-r--r--mesonbuild/modules/gnome.py2
-rw-r--r--mesonbuild/modules/python.py2
-rw-r--r--mesonbuild/modules/rust.py2
-rw-r--r--mesonbuild/options.py3
13 files changed, 17 insertions, 20 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index a47a948ee..e243e9b58 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -3872,7 +3872,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
if extra_arg:
target_name += f'-{extra_arg}'
extra_args.append(f'--{extra_arg}')
- colorout = self.environment.coredata.optstore.get_value('b_colorout') \
+ colorout = self.environment.coredata.optstore.get_value_for('b_colorout') \
if OptionKey('b_colorout') in self.environment.coredata.optstore else 'always'
assert isinstance(colorout, str), 'for mypy'
extra_args.extend(['--color', colorout])
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 8804b8daa..fde3874b5 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -538,7 +538,7 @@ class Vs2010Backend(backends.Backend):
replace_if_different(sln_filename, sln_filename_tmp)
def generate_projects(self, vslite_ctx: dict = None) -> T.List[Project]:
- startup_project = self.environment.coredata.optstore.get_value('backend_startup_project')
+ startup_project = self.environment.coredata.optstore.get_value_for('backend_startup_project')
projlist: T.List[Project] = []
startup_idx = 0
for (i, (name, target)) in enumerate(self.build.targets.items()):
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index a492fffed..454f5fba8 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -361,8 +361,8 @@ class CLikeCompiler(Compiler):
# linking with static libraries since MSVC won't select a CRT for
# us in that case and will error out asking us to pick one.
try:
- crt_val = env.coredata.optstore.get_value('b_vscrt')
- buildtype = env.coredata.optstore.get_value('buildtype')
+ crt_val = env.coredata.optstore.get_value_for('b_vscrt')
+ buildtype = env.coredata.optstore.get_value_for('buildtype')
assert isinstance(crt_val, str), 'for mypy'
assert isinstance(buildtype, str), 'for mypy'
cargs += self.get_crt_compile_args(crt_val, buildtype)
diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py
index 83534e11c..1af2236e9 100644
--- a/mesonbuild/compilers/mixins/emscripten.py
+++ b/mesonbuild/compilers/mixins/emscripten.py
@@ -50,7 +50,7 @@ class EmscriptenMixin(Compiler):
def thread_link_flags(self, env: 'Environment') -> T.List[str]:
args = ['-pthread']
- count = env.coredata.optstore.get_value(OptionKey(f'{self.language}_thread_count', machine=self.for_machine))
+ count = env.coredata.optstore.get_value_for(OptionKey(f'{self.language}_thread_count', machine=self.for_machine))
assert isinstance(count, int)
if count:
args.append(f'-sPTHREAD_POOL_SIZE={count}')
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 2a0cd1131..d5b337169 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -490,7 +490,7 @@ class CoreData:
def get_external_args(self, for_machine: MachineChoice, lang: str) -> T.List[str]:
# mypy cannot analyze type of OptionKey
key = OptionKey(f'{lang}_args', machine=for_machine)
- return T.cast('T.List[str]', self.optstore.get_value(key))
+ return T.cast('T.List[str]', self.optstore.get_value_for(key))
@lru_cache(maxsize=None)
def get_external_link_args(self, for_machine: MachineChoice, lang: str) -> T.List[str]:
@@ -604,7 +604,7 @@ class CoreData:
def emit_base_options_warnings(self) -> None:
bcodekey = OptionKey('b_bitcode')
- if bcodekey in self.optstore and self.optstore.get_value(bcodekey):
+ if bcodekey in self.optstore and self.optstore.get_value_for(bcodekey):
msg = textwrap.dedent('''Base option 'b_bitcode' is enabled, which is incompatible with many linker options.
Incompatible options such as \'b_asneeded\' have been disabled.'
Please see https://mesonbuild.com/Builtin-options.html#Notes_about_Apple_Bitcode_support for more details.''')
diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py
index fdb35d432..82a232f3d 100644
--- a/mesonbuild/dependencies/boost.py
+++ b/mesonbuild/dependencies/boost.py
@@ -604,9 +604,9 @@ class BoostDependency(SystemDependency):
# MSVC is very picky with the library tags
vscrt = ''
try:
- crt_val = self.env.coredata.optstore.get_value('b_vscrt')
+ crt_val = self.env.coredata.optstore.get_value_for('b_vscrt')
assert isinstance(crt_val, str)
- buildtype = self.env.coredata.optstore.get_value('buildtype')
+ buildtype = self.env.coredata.optstore.get_value_for('buildtype')
assert isinstance(buildtype, str)
vscrt = self.clib_compiler.get_crt_compile_args(crt_val, buildtype)[0]
except (KeyError, IndexError, AttributeError):
diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py
index 012b716f6..a1390fb59 100644
--- a/mesonbuild/dependencies/pkgconfig.py
+++ b/mesonbuild/dependencies/pkgconfig.py
@@ -432,7 +432,7 @@ class PkgConfigDependency(ExternalDependency):
#
# Only prefix_libpaths are reordered here because there should not be
# too many system_libpaths to cause library version issues.
- pkg_config_path: T.List[str] = self.env.coredata.optstore.get_value(OptionKey('pkg_config_path', machine=self.for_machine)) # type: ignore[assignment]
+ pkg_config_path: T.List[str] = self.env.coredata.optstore.get_value_for(OptionKey('pkg_config_path', machine=self.for_machine)) # type: ignore[assignment]
pkg_config_path = self._convert_mingw_paths(pkg_config_path)
prefix_libpaths = OrderedSet(sort_libpaths(list(prefix_libpaths), pkg_config_path))
system_libpaths: OrderedSet[str] = OrderedSet()
diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py
index d2d9809dc..5c5ed384f 100644
--- a/mesonbuild/dependencies/python.py
+++ b/mesonbuild/dependencies/python.py
@@ -397,7 +397,7 @@ class _PythonDependencyBase(_Base):
is_debug_build = debug or buildtype == 'debug'
vscrt_debug = False
if OptionKey('b_vscrt') in self.env.coredata.optstore:
- vscrt = self.env.coredata.optstore.get_value('b_vscrt')
+ vscrt = self.env.coredata.optstore.get_value_for('b_vscrt')
if vscrt in {'mdd', 'mtd', 'from_buildtype', 'static_from_buildtype'}:
vscrt_debug = True
if is_debug_build and vscrt_debug and not self.variables.get('Py_DEBUG'):
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index a682bc822..a5d9e8fb4 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -3081,9 +3081,9 @@ class Interpreter(InterpreterBase, HoldableObject):
return
if OptionKey('b_sanitize') not in self.coredata.optstore:
return
- if (self.coredata.optstore.get_value('b_lundef') and
- self.coredata.optstore.get_value('b_sanitize')):
- value = self.coredata.optstore.get_value('b_sanitize')
+ if (self.coredata.optstore.get_value_for('b_lundef') and
+ self.coredata.optstore.get_value_for('b_sanitize')):
+ value = self.coredata.optstore.get_value_for('b_sanitize')
mlog.warning(textwrap.dedent(f'''\
Trying to use {value} sanitizer on Clang with b_lundef.
This will probably not work.
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 70b1165a2..6a7685390 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -922,7 +922,7 @@ class GnomeModule(ExtensionModule):
if state.project_args.get(lang):
cflags += state.project_args[lang]
if OptionKey('b_sanitize') in compiler.base_options:
- sanitize = state.environment.coredata.optstore.get_value('b_sanitize')
+ sanitize = state.environment.coredata.optstore.get_value_for('b_sanitize')
assert isinstance(sanitize, list)
cflags += compiler.sanitizer_compile_args(sanitize)
# These must be first in ldflags
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index a266f3a3b..6f5a63a0b 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -206,7 +206,7 @@ class PythonInstallation(_ExternalProgramHolder['PythonExternalProgram']):
new_link_args = mesonlib.extract_as_list(kwargs, 'link_args')
- is_debug = self.interpreter.environment.coredata.optstore.get_value('debug')
+ is_debug = self.interpreter.environment.coredata.optstore.get_value_for('debug')
if is_debug:
new_link_args.append(python_windows_debug_link_exception)
else:
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py
index d0e809181..59702d756 100644
--- a/mesonbuild/modules/rust.py
+++ b/mesonbuild/modules/rust.py
@@ -443,7 +443,7 @@ class RustModule(ExtensionModule):
if self._bindgen_rust_target and '--rust-target' not in cmd:
cmd.extend(['--rust-target', self._bindgen_rust_target])
if self._bindgen_set_std and '--rust-edition' not in cmd:
- rust_std = state.environment.coredata.optstore.get_value('rust_std')
+ rust_std = state.environment.coredata.optstore.get_value_for('rust_std')
assert isinstance(rust_std, str), 'for mypy'
if rust_std != 'none':
cmd.extend(['--rust-edition', rust_std])
diff --git a/mesonbuild/options.py b/mesonbuild/options.py
index 54e7e4664..4d5bb5804 100644
--- a/mesonbuild/options.py
+++ b/mesonbuild/options.py
@@ -845,9 +845,6 @@ class OptionStore:
return self.options[key].value
return self.pending_options.get(key, default)
- def get_value(self, key: T.Union[OptionKey, str]) -> ElementaryOptionValues:
- return self.get_value_for(key)
-
def __len__(self) -> int:
return len(self.options)