aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/optinterpreter.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-08-27 13:47:14 -0400
committerXavier Claessens <xclaesse@gmail.com>2021-10-09 18:13:34 -0400
commit77ef437cc46954fddc23402a50931a700c9dd187 (patch)
tree8468b562e88abc8be504327fa714d05bf4c23904 /mesonbuild/optinterpreter.py
parent953bbf5e1946f14d486ee28cd3cd261cbb79b33f (diff)
downloadmeson-77ef437cc46954fddc23402a50931a700c9dd187.zip
meson-77ef437cc46954fddc23402a50931a700c9dd187.tar.gz
meson-77ef437cc46954fddc23402a50931a700c9dd187.tar.bz2
optinterpreter: Add deprecated kwarg
It can be either: - boolean: the option is completely deprecated. - list: some choices are deprecated. - dict: some choices are deprecated and replaced by another. Fixes: #7444
Diffstat (limited to 'mesonbuild/optinterpreter.py')
-rw-r--r--mesonbuild/optinterpreter.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index 74b0a56..d7565f2 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -32,6 +32,7 @@ if T.TYPE_CHECKING:
'value': object,
'min': T.Optional[int],
'max': T.Optional[int],
+ 'deprecated': T.Union[bool, T.Dict[str, str], T.List[str]],
})
ParserArgs = TypedDict('ParserArgs', {
'yield': bool,
@@ -167,6 +168,8 @@ class OptionInterpreter:
KwargInfo('value', object),
KwargInfo('min', (int, type(None))),
KwargInfo('max', (int, type(None))),
+ KwargInfo('deprecated', (bool, ContainerTypeInfo(dict, str), ContainerTypeInfo(list, str)),
+ default=False, since='0.60.0')
)
@typed_pos_args('option', str)
def func_option(self, args: T.Tuple[str], kwargs: 'FuncOptionArgs') -> None:
@@ -187,6 +190,7 @@ class OptionInterpreter:
known_parser_kwargs = {'value', 'choices', 'yield', 'min', 'max'}
parser_kwargs = {k: v for k, v in kwargs.items() if k in known_parser_kwargs and v is not None}
opt = parser(description, T.cast('ParserArgs', parser_kwargs))
+ opt.deprecated = kwargs['deprecated']
key = mesonlib.OptionKey(opt_name, self.subproject)
if key in self.options: