aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-05-26 15:46:10 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-05-26 17:42:14 -0400
commitfda4c49c34f2650b739ebf741e45228c5ebafb0c (patch)
treede8d5d765aa116ccbdc4203f479535a8b04594b3 /mesonbuild/interpreter
parent9b9154017e9edc7b5b3bd93dce74ffa9c8b22a03 (diff)
downloadmeson-fda4c49c34f2650b739ebf741e45228c5ebafb0c.zip
meson-fda4c49c34f2650b739ebf741e45228c5ebafb0c.tar.gz
meson-fda4c49c34f2650b739ebf741e45228c5ebafb0c.tar.bz2
fix custom_target crash if boolean true is specified in install_dir
We accept boolean false to indicate "do not install this one particular output", but the type checking simply checked if it is a bool. We do this correctly for configure_file, so copy the same validator from there.
Diffstat (limited to 'mesonbuild/interpreter')
-rw-r--r--mesonbuild/interpreter/kwargs.py2
-rw-r--r--mesonbuild/interpreter/type_checking.py3
2 files changed, 3 insertions, 2 deletions
diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py
index f2460ac..bb56ff2 100644
--- a/mesonbuild/interpreter/kwargs.py
+++ b/mesonbuild/interpreter/kwargs.py
@@ -183,7 +183,7 @@ class CustomTarget(TypedDict):
input: T.List[T.Union[str, build.BuildTarget, build.CustomTarget, build.CustomTargetIndex,
build.ExtractedObjects, build.GeneratedList, ExternalProgram, File]]
install: bool
- install_dir: T.List[T.Union[str, bool]]
+ install_dir: T.List[T.Union[str, T.Literal[False]]]
install_mode: FileMode
install_tag: T.List[T.Optional[str]]
output: T.List[str]
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index 328f032..ee6eef5 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -297,11 +297,12 @@ INSTALL_TAG_KW: KwargInfo[T.Optional[str]] = KwargInfo('install_tag', (str, None
INSTALL_KW = KwargInfo('install', bool, default=False)
-CT_INSTALL_DIR_KW: KwargInfo[T.List[T.Union[str, bool]]] = KwargInfo(
+CT_INSTALL_DIR_KW: KwargInfo[T.List[T.Union[str, Literal[False]]]] = KwargInfo(
'install_dir',
ContainerTypeInfo(list, (str, bool)),
listify=True,
default=[],
+ validator=lambda x: 'must be `false` if boolean' if True in x else None,
)
CT_BUILD_BY_DEFAULT: KwargInfo[T.Optional[bool]] = KwargInfo('build_by_default', (bool, type(None)), since='0.40.0')