aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/coredata.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-05-03 10:20:15 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2023-08-06 09:39:56 -0400
commit7600856e0a1b1e058ef684928ac29a92218b1257 (patch)
tree2d09be96d3b70eab45b2a8c91339d53a24cb4a1b /mesonbuild/coredata.py
parent48c17b7ae651b5819938392502d341377cb4435a (diff)
downloadmeson-7600856e0a1b1e058ef684928ac29a92218b1257.zip
meson-7600856e0a1b1e058ef684928ac29a92218b1257.tar.gz
meson-7600856e0a1b1e058ef684928ac29a92218b1257.tar.bz2
UserArrayOption: Make listify_value() a static method
Diffstat (limited to 'mesonbuild/coredata.py')
-rw-r--r--mesonbuild/coredata.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 975719e..97261d6 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -256,7 +256,8 @@ class UserArrayOption(UserOption[T.List[str]]):
self.allow_dups = allow_dups
self.set_value(value)
- def listify(self, value: T.Union[str, T.List[str]]) -> T.List[str]:
+ @staticmethod
+ def listify_value(value: T.Union[str, T.List[str]], shlex_split_args: bool = False) -> T.List[str]:
if isinstance(value, str):
if value.startswith('['):
try:
@@ -266,7 +267,7 @@ class UserArrayOption(UserOption[T.List[str]]):
elif value == '':
newvalue = []
else:
- if self.split_args:
+ if shlex_split_args:
newvalue = split_args(value)
else:
newvalue = [v.strip() for v in value.split(',')]
@@ -276,6 +277,9 @@ class UserArrayOption(UserOption[T.List[str]]):
raise MesonException(f'"{value}" should be a string array, but it is not')
return newvalue
+ def listify(self, value: T.Any) -> T.List[T.Any]:
+ return self.listify_value(value, self.split_args)
+
def validate_value(self, value: T.Union[str, T.List[str]]) -> T.List[str]:
newvalue = self.listify(value)