diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2025-03-12 11:02:07 -0700 |
|---|---|---|
| committer | Dylan Baker <dylan@pnwbakers.com> | 2025-04-08 10:00:16 -0700 |
| commit | 390ea4624c2fbfecf831f1c7f34ec796ff410de7 (patch) | |
| tree | 347a332c2730d923550ad590d271a6af1f0027d3 | |
| parent | 00864ca481c4e29d7f5c648a1e12b934dfa642d2 (diff) | |
| download | meson-390ea4624c2fbfecf831f1c7f34ec796ff410de7.tar.gz | |
coredata: move MutableKeyedOptionDict to options
| -rw-r--r-- | mesonbuild/compilers/c.py | 2 | ||||
| -rw-r--r-- | mesonbuild/compilers/compilers.py | 2 | ||||
| -rw-r--r-- | mesonbuild/compilers/cpp.py | 2 | ||||
| -rw-r--r-- | mesonbuild/compilers/cuda.py | 4 | ||||
| -rw-r--r-- | mesonbuild/compilers/cython.py | 4 | ||||
| -rw-r--r-- | mesonbuild/compilers/fortran.py | 2 | ||||
| -rw-r--r-- | mesonbuild/compilers/mixins/clang.py | 2 | ||||
| -rw-r--r-- | mesonbuild/compilers/mixins/emscripten.py | 3 | ||||
| -rw-r--r-- | mesonbuild/compilers/mixins/gnu.py | 4 | ||||
| -rw-r--r-- | mesonbuild/compilers/objc.py | 4 | ||||
| -rw-r--r-- | mesonbuild/compilers/objcpp.py | 4 | ||||
| -rw-r--r-- | mesonbuild/compilers/rust.py | 4 | ||||
| -rw-r--r-- | mesonbuild/compilers/swift.py | 2 | ||||
| -rw-r--r-- | mesonbuild/coredata.py | 3 | ||||
| -rw-r--r-- | mesonbuild/mconf.py | 17 | ||||
| -rw-r--r-- | mesonbuild/mintro.py | 8 | ||||
| -rw-r--r-- | mesonbuild/optinterpreter.py | 3 | ||||
| -rw-r--r-- | mesonbuild/options.py | 1 |
18 files changed, 35 insertions, 36 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index a6769fc96..7a2fec59e 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -37,7 +37,7 @@ from .compilers import ( ) if T.TYPE_CHECKING: - from ..coredata import MutableKeyedOptionDictType + from ..options import MutableKeyedOptionDictType from ..dependencies import Dependency from ..envconfig import MachineInfo from ..environment import Environment diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 89eceab75..a3b243dd9 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -26,7 +26,7 @@ from ..arglist import CompilerArgs if T.TYPE_CHECKING: from .. import coredata from ..build import BuildTarget, DFeatures - from ..coredata import MutableKeyedOptionDictType + from ..options import MutableKeyedOptionDictType from ..envconfig import MachineInfo from ..environment import Environment from ..linkers import RSPFileSyntax diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index b85751d05..01b9bb9fa 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -34,7 +34,7 @@ from .mixins.metrowerks import MetrowerksCompiler from .mixins.metrowerks import mwccarm_instruction_set_args, mwcceppc_instruction_set_args if T.TYPE_CHECKING: - from ..coredata import MutableKeyedOptionDictType + from ..options import MutableKeyedOptionDictType from ..dependencies import Dependency from ..envconfig import MachineInfo from ..environment import Environment diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 509044cd4..6cc6f963b 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2012-2017 The Meson development team -# Copyright © 2023-2024 Intel Corporation +# Copyright © 2023-2025 Intel Corporation from __future__ import annotations @@ -19,7 +19,7 @@ from .compilers import Compiler, CompileCheckMode if T.TYPE_CHECKING: from ..build import BuildTarget - from ..coredata import MutableKeyedOptionDictType + from ..options import MutableKeyedOptionDictType from ..dependencies import Dependency from ..environment import Environment # noqa: F401 from ..envconfig import MachineInfo diff --git a/mesonbuild/compilers/cython.py b/mesonbuild/compilers/cython.py index 27cad5502..50bb4652b 100644 --- a/mesonbuild/compilers/cython.py +++ b/mesonbuild/compilers/cython.py @@ -1,5 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -# Copyright © 2021-2024 Intel Corporation +# Copyright © 2021-2025 Intel Corporation from __future__ import annotations """Abstraction for Cython language compilers.""" @@ -11,7 +11,7 @@ from ..mesonlib import EnvironmentException, version_compare from .compilers import Compiler if T.TYPE_CHECKING: - from ..coredata import MutableKeyedOptionDictType + from ..options import MutableKeyedOptionDictType from ..environment import Environment from ..build import BuildTarget diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index 0bbd7d0ef..5794db06b 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -27,7 +27,7 @@ from mesonbuild.mesonlib import ( ) if T.TYPE_CHECKING: - from ..coredata import MutableKeyedOptionDictType + from ..options import MutableKeyedOptionDictType from ..dependencies import Dependency from ..envconfig import MachineInfo from ..environment import Environment diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py index 867b58680..ae5ab631b 100644 --- a/mesonbuild/compilers/mixins/clang.py +++ b/mesonbuild/compilers/mixins/clang.py @@ -18,7 +18,7 @@ from ..compilers import CompileCheckMode from .gnu import GnuLikeCompiler if T.TYPE_CHECKING: - from ...coredata import MutableKeyedOptionDictType + from ...options import MutableKeyedOptionDictType from ...environment import Environment from ...dependencies import Dependency # noqa: F401 from ..compilers import Compiler diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py index c5b2e6dac..91b25e8f7 100644 --- a/mesonbuild/compilers/mixins/emscripten.py +++ b/mesonbuild/compilers/mixins/emscripten.py @@ -15,7 +15,6 @@ from ...mesonlib import LibType from mesonbuild.compilers.compilers import CompileCheckMode if T.TYPE_CHECKING: - from ... import coredata from ...environment import Environment from ...compilers.compilers import Compiler from ...dependencies import Dependency @@ -57,7 +56,7 @@ class EmscriptenMixin(Compiler): args.append(f'-sPTHREAD_POOL_SIZE={count}') return args - def get_options(self) -> coredata.MutableKeyedOptionDictType: + def get_options(self) -> options.MutableKeyedOptionDictType: opts = super().get_options() key = OptionKey(f'{self.language}_thread_count', machine=self.for_machine) diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index 70fd9ee7d..9ea591e04 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2019-2022 The meson development team -# Copyright © 2023 Intel Corporation +# Copyright © 2023-2025 Intel Corporation from __future__ import annotations @@ -21,7 +21,7 @@ from mesonbuild.compilers.compilers import CompileCheckMode if T.TYPE_CHECKING: from ..._typing import ImmutableListProtocol - from ...coredata import MutableKeyedOptionDictType + from ...options import MutableKeyedOptionDictType from ...environment import Environment from ..compilers import Compiler else: diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py index c36373f43..d013417fc 100644 --- a/mesonbuild/compilers/objc.py +++ b/mesonbuild/compilers/objc.py @@ -15,12 +15,12 @@ from .mixins.clike import CLikeCompiler from .mixins.gnu import GnuCompiler, GnuCStds, gnu_common_warning_args, gnu_objc_warning_args if T.TYPE_CHECKING: - from .. import coredata from ..envconfig import MachineInfo from ..environment import Environment from ..linkers.linkers import DynamicLinker from ..mesonlib import MachineChoice from ..build import BuildTarget + from ..options import MutableKeyedOptionDictType class ObjCCompiler(CLikeCompiler, Compiler): @@ -36,7 +36,7 @@ class ObjCCompiler(CLikeCompiler, Compiler): linker=linker) CLikeCompiler.__init__(self) - def get_options(self) -> coredata.MutableKeyedOptionDictType: + def get_options(self) -> MutableKeyedOptionDictType: opts = super().get_options() key = self.form_compileropt_key('std') opts.update({ diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py index b1cb605e3..441428b2f 100644 --- a/mesonbuild/compilers/objcpp.py +++ b/mesonbuild/compilers/objcpp.py @@ -15,12 +15,12 @@ from .mixins.clang import ClangCompiler, ClangCPPStds from .mixins.clike import CLikeCompiler if T.TYPE_CHECKING: - from .. import coredata from ..envconfig import MachineInfo from ..environment import Environment from ..linkers.linkers import DynamicLinker from ..mesonlib import MachineChoice from ..build import BuildTarget + from ..options import MutableKeyedOptionDictType class ObjCPPCompiler(CLikeCompiler, Compiler): @@ -54,7 +54,7 @@ class ObjCPPCompiler(CLikeCompiler, Compiler): code = '#import<stdio.h>\nclass MyClass;int main(void) { return 0; }\n' return self._sanity_check_impl(work_dir, environment, 'sanitycheckobjcpp.mm', code) - def get_options(self) -> coredata.MutableKeyedOptionDictType: + def get_options(self) -> MutableKeyedOptionDictType: opts = super().get_options() key = self.form_compileropt_key('std') opts.update({ diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 53b3afbf2..3e9c016f6 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright 2012-2022 The Meson development team -# Copyright © 2023-2024 Intel Corporation +# Copyright © 2023-2025 Intel Corporation from __future__ import annotations @@ -16,7 +16,7 @@ from ..options import OptionKey from .compilers import Compiler, CompileCheckMode, clike_debug_args if T.TYPE_CHECKING: - from ..coredata import MutableKeyedOptionDictType + from ..options import MutableKeyedOptionDictType from ..envconfig import MachineInfo from ..environment import Environment # noqa: F401 from ..linkers.linkers import DynamicLinker diff --git a/mesonbuild/compilers/swift.py b/mesonbuild/compilers/swift.py index c28e7af25..8410fbbda 100644 --- a/mesonbuild/compilers/swift.py +++ b/mesonbuild/compilers/swift.py @@ -14,7 +14,7 @@ from .compilers import Compiler, clike_debug_args if T.TYPE_CHECKING: from .. import build - from ..coredata import MutableKeyedOptionDictType + from ..options import MutableKeyedOptionDictType from ..dependencies import Dependency from ..envconfig import MachineInfo from ..environment import Environment diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 03d80d940..4791fe128 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -43,7 +43,7 @@ if T.TYPE_CHECKING: from .mesonlib import FileOrString from .cmake.traceparser import CMakeCacheEntry from .interpreterbase import SubProject - from .options import ElementaryOptionValues + from .options import ElementaryOptionValues, MutableKeyedOptionDictType from .build import BuildTarget class SharedCMDOptions(Protocol): @@ -62,7 +62,6 @@ if T.TYPE_CHECKING: native_file: T.List[str] OptionDictType = T.Dict[str, options.AnyOptionType] - MutableKeyedOptionDictType = T.Dict['OptionKey', options.AnyOptionType] CompilerCheckCacheKey = T.Tuple[T.Tuple[str, ...], str, FileOrString, T.Tuple[str, ...], CompileCheckMode] # code, args RunCheckCacheKey = T.Tuple[str, T.Tuple[str, ...]] diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py index 0811062f3..cf2162232 100644 --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -190,9 +190,10 @@ class Conf: items = [l[i] if l[i] else ' ' * four_column[i] for i in range(4)] mlog.log(*items) - def split_options_per_subproject(self, options: T.Union[coredata.MutableKeyedOptionDictType, options.OptionStore]) -> T.Dict[str, 'coredata.MutableKeyedOptionDictType']: - result: T.Dict[str, 'coredata.MutableKeyedOptionDictType'] = {} - for k, o in options.items(): + def split_options_per_subproject(self, opts: T.Union[options.MutableKeyedOptionDictType, options.OptionStore] + ) -> T.Dict[str, options.MutableKeyedOptionDictType]: + result: T.Dict[str, options.MutableKeyedOptionDictType] = {} + for k, o in opts.items(): if k.subproject: self.all_subprojects.add(k.subproject) result.setdefault(k.subproject, {})[k] = o @@ -228,7 +229,7 @@ class Conf: self._add_line(mlog.normal_yellow(section + ':'), '', '', '') self.print_margin = 2 - def print_options(self, title: str, opts: T.Union[coredata.MutableKeyedOptionDictType, options.OptionStore]) -> None: + def print_options(self, title: str, opts: T.Union[options.MutableKeyedOptionDictType, options.OptionStore]) -> None: if not opts: return if title: @@ -264,10 +265,10 @@ class Conf: test_option_names = {OptionKey('errorlogs'), OptionKey('stdsplit')} - dir_options: 'coredata.MutableKeyedOptionDictType' = {} - test_options: 'coredata.MutableKeyedOptionDictType' = {} - core_options: 'coredata.MutableKeyedOptionDictType' = {} - module_options: T.Dict[str, 'coredata.MutableKeyedOptionDictType'] = collections.defaultdict(dict) + dir_options: options.MutableKeyedOptionDictType = {} + test_options: options.MutableKeyedOptionDictType = {} + core_options: options.MutableKeyedOptionDictType = {} + module_options: T.Dict[str, options.MutableKeyedOptionDictType] = collections.defaultdict(dict) for k, v in self.coredata.optstore.options.items(): if k in dir_option_names: dir_options[k] = v diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 9b2a01f4c..462ee2fb4 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -290,9 +290,9 @@ def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[s test_option_names = {OptionKey('errorlogs'), OptionKey('stdsplit')} - dir_options: 'cdata.MutableKeyedOptionDictType' = {} - test_options: 'cdata.MutableKeyedOptionDictType' = {} - core_options: 'cdata.MutableKeyedOptionDictType' = {} + dir_options: options.MutableKeyedOptionDictType = {} + test_options: options.MutableKeyedOptionDictType = {} + core_options: options.MutableKeyedOptionDictType = {} for k, v in coredata.optstore.items(): if k in dir_option_names: dir_options[k] = v @@ -304,7 +304,7 @@ def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[s for s in subprojects: core_options[k.evolve(subproject=s)] = v - def add_keys(opts: T.Union[cdata.MutableKeyedOptionDictType, options.OptionStore], section: str) -> None: + def add_keys(opts: T.Union[options.MutableKeyedOptionDictType, options.OptionStore], section: str) -> None: for key, opt in sorted(opts.items()): optdict = {'name': str(key), 'value': opt.value, 'section': section, 'machine': key.machine.get_lower_case_name() if coredata.optstore.is_per_machine_option(key) else 'any'} diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index c33306d5c..892d4d5e3 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -15,7 +15,6 @@ from .interpreterbase import FeatureNew, FeatureDeprecated, typed_pos_args, type from .interpreter.type_checking import NoneType, in_set_validator if T.TYPE_CHECKING: - from . import coredata from .interpreterbase import TYPE_var, TYPE_kwargs from .interpreterbase import SubProject from typing_extensions import TypedDict, Literal @@ -67,7 +66,7 @@ optname_regex = re.compile('[^a-zA-Z0-9_-]') class OptionInterpreter: def __init__(self, optionstore: 'OptionStore', subproject: 'SubProject') -> None: - self.options: 'coredata.MutableKeyedOptionDictType' = {} + self.options: options.MutableKeyedOptionDictType = {} self.subproject = subproject self.option_types: T.Dict[str, T.Callable[..., options.AnyOptionType]] = { 'string': self.string_parser, diff --git a/mesonbuild/options.py b/mesonbuild/options.py index f45c121a8..3ad4f9155 100644 --- a/mesonbuild/options.py +++ b/mesonbuild/options.py @@ -41,6 +41,7 @@ if T.TYPE_CHECKING: 'UserIntegerOption', 'UserStdOption', 'UserStringArrayOption', 'UserStringOption', 'UserUmaskOption'] ElementaryOptionValues: TypeAlias = T.Union[str, int, bool, T.List[str]] + MutableKeyedOptionDictType: TypeAlias = T.Dict['OptionKey', AnyOptionType] _OptionKeyTuple: TypeAlias = T.Tuple[T.Optional[str], MachineChoice, str] |
