summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-01-10 14:26:01 -0800
committerDylan Baker <dylan@pnwbakers.com>2025-10-15 10:21:46 -0700
commit72509ed0aa5e493567164a7feb2d72c11f05a606 (patch)
tree8f54888ba5c6e432322baf3bb5bb1a8f6440fb49
parentede3f49903b5b797dfb92e0fd341921a611a97eb (diff)
downloadmeson-72509ed0aa5e493567164a7feb2d72c11f05a606.tar.gz
interpreter: move the BuildTarget install feature validator to KwargInfo
-rw-r--r--mesonbuild/interpreter/interpreter.py6
-rw-r--r--mesonbuild/interpreter/type_checking.py17
2 files changed, 15 insertions, 8 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 3c14a32f9..72e937904 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -3460,12 +3460,6 @@ class Interpreter(InterpreterBase, HoldableObject):
sources = [s for s in sources
if not isinstance(s, (build.BuildTarget, build.ExtractedObjects))]
- # due to lack of type checking, these are "allowed" for legacy reasons
- if not isinstance(kwargs['install'], bool):
- FeatureBroken.single_use('install kwarg with non-boolean value', '1.3.0', self.subproject,
- 'This was never intended to work, and is essentially the same as using `install: true` regardless of value.',
- node)
-
sources = self.source_strings_to_files(sources)
objs = kwargs['objects']
kwargs['dependencies'] = extract_as_list(kwargs, 'dependencies')
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index 50f07699b..952049c9b 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -14,7 +14,7 @@ from ..build import (CustomTarget, BuildTarget,
LocalProgram)
from ..options import OptionKey, UserFeatureOption
from ..dependencies import Dependency, InternalDependency
-from ..interpreterbase.decorators import KwargInfo, ContainerTypeInfo
+from ..interpreterbase.decorators import KwargInfo, ContainerTypeInfo, FeatureBroken
from ..mesonlib import (File, FileMode, MachineChoice, has_path_sep, listify, stringlistify,
EnvironmentVariables)
from ..programs import ExternalProgram
@@ -29,6 +29,7 @@ if T.TYPE_CHECKING:
from ..interpreterbase import TYPE_var
from ..options import ElementaryOptionValues
from ..mesonlib import EnvInitValueType
+ from ..interpreterbase.decorators import FeatureCheckBase
_FullEnvInitValueType = T.Union[EnvironmentVariables, T.List[str], T.List[T.List[str]], EnvInitValueType, str, None]
PkgConfigDefineType = T.Optional[T.Tuple[T.Tuple[str, str], ...]]
@@ -571,13 +572,25 @@ def _objects_validator(vals: T.List[ObjectTypes]) -> T.Optional[str]:
return None
+def _target_install_feature_validator(val: object) -> T.Iterable[FeatureCheckBase]:
+ # due to lack of type checking, these are "allowed" for legacy reasons
+ if not isinstance(val, bool):
+ yield FeatureBroken('install kwarg with non-boolean value', '1.3.0',
+ 'This was never intended to work, and is essentially the same as using `install: true` regardless of value.')
+
+
# Applies to all build_target like classes
_ALL_TARGET_KWS: T.List[KwargInfo] = [
OVERRIDE_OPTIONS_KW,
KwargInfo('build_by_default', bool, default=True, since='0.38.0'),
KwargInfo('extra_files', ContainerTypeInfo(list, (str, File)), default=[], listify=True),
# Accursed. We allow this for backwards compat and warn in the interpreter.
- KwargInfo('install', object, default=False),
+ KwargInfo(
+ 'install',
+ object,
+ default=False,
+ feature_validator=_target_install_feature_validator,
+ ),
INSTALL_MODE_KW,
KwargInfo('implicit_include_directories', bool, default=True, since='0.42.0'),
NATIVE_KW,