summaryrefslogtreecommitdiff
path: root/mesonbuild/mintro.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2024-09-06 11:52:56 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2025-02-05 17:45:38 +0200
commit9fd5281befe7881c9d1210c9e6865382bc0f2b08 (patch)
tree45530ef9752f3537f23dd564f2fb6c657417fc0f /mesonbuild/mintro.py
parent8eba69cbaaa6498ecb0a43fac64e81b7f764d572 (diff)
downloadmeson-9fd5281befe7881c9d1210c9e6865382bc0f2b08.tar.gz
options: Replace uses of `UserOption[T.Any]` with a Union of UserOption types
The fact that UserOption is generic is really an implementation detail, not something to be used publicly. So by having an `AnyOptionType` alias, we can get better type checking, as can be seen by the patch as a whole. One of the big fixes it replace open-coded equivlalents of `MutableKeydOptionDictType` with that type alias.
Diffstat (limited to 'mesonbuild/mintro.py')
-rw-r--r--mesonbuild/mintro.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py
index 4b65c5aca..383f15473 100644
--- a/mesonbuild/mintro.py
+++ b/mesonbuild/mintro.py
@@ -30,8 +30,6 @@ from .mparser import FunctionNode, ArrayNode, ArgumentNode, StringNode
if T.TYPE_CHECKING:
import argparse
- from typing import Any
- from .options import UserOption
from .interpreter import Interpreter
from .mparser import BaseNode
@@ -306,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[dict[OptionKey, UserOption[Any]], cdata.KeyedOptionDictType]', section: str) -> None:
+ def add_keys(opts: T.Union[cdata.MutableKeyedOptionDictType, cdata.KeyedOptionDictType], 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.is_per_machine_option(key) else 'any'}