aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-02-27 21:28:31 -0500
committerEli Schwartz <eschwartz@archlinux.org>2022-04-13 17:27:09 -0400
commitb55349c2e9ac6f9e37e2fd6e7a8333f6893fbaa9 (patch)
tree96c13c307755d882c82e86836c0abf16755be52a /mesonbuild/interpreter
parentc649a2b8c59c9f49affca9bd89c126bfa0f54449 (diff)
downloadmeson-b55349c2e9ac6f9e37e2fd6e7a8333f6893fbaa9.zip
meson-b55349c2e9ac6f9e37e2fd6e7a8333f6893fbaa9.tar.gz
meson-b55349c2e9ac6f9e37e2fd6e7a8333f6893fbaa9.tar.bz2
dependencies: tighten type checking and fix cmake API violation for get_variable
dep.get_variable() only supports string values for pkg-config and config-tool, because those interfaces use text communication, and internal variables (from declare_dependency) operate the same way. CMake had an oddity, where get_variable doesn't document that it allows list values but apparently it miiiiiight work? Actually getting that kind of result would be dangerously inconsistent though. Also, CMake does not support lists so it's a lie. Strings that are *treated* as lists with `;` splitting don't count... We could do two things here: - raise an error - treat it as a string and return a string It's not clear what the use case of get_variable() on a maybe-list is, and should probably be a hard error. But that's controversial, so instead we just return the original `;`-delimited string. It is probably the wrong thing, but users are welcome to cope with that somehow on their own.
Diffstat (limited to 'mesonbuild/interpreter')
-rw-r--r--mesonbuild/interpreter/interpreterobjects.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/interpreterobjects.py b/mesonbuild/interpreter/interpreterobjects.py
index 6cc636b..39085e5 100644
--- a/mesonbuild/interpreter/interpreterobjects.py
+++ b/mesonbuild/interpreter/interpreterobjects.py
@@ -479,7 +479,7 @@ class DependencyHolder(ObjectHolder[Dependency]):
KwargInfo('default_value', (str, NoneType)),
KwargInfo('pkgconfig_define', ContainerTypeInfo(list, str, pairs=True), default=[], listify=True),
)
- def variable_method(self, args: T.Tuple[T.Optional[str]], kwargs: 'kwargs.DependencyGetVariable') -> T.Union[str, T.List[str]]:
+ def variable_method(self, args: T.Tuple[T.Optional[str]], kwargs: 'kwargs.DependencyGetVariable') -> str:
default_varname = args[0]
if default_varname is not None:
FeatureNew('Positional argument to dependency.get_variable()', '0.58.0').use(self.subproject, self.current_node)