summaryrefslogtreecommitdiff
path: root/mesonbuild/coredata.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-11-27 22:16:32 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-12-02 20:34:45 +0200
commitdae21b70db07ca4d1a65c34fac6ec090761ac45f (patch)
treeaf5713459e1f9413ab07cb1cd3ec5b8c6ee72d29 /mesonbuild/coredata.py
parentaa6b5762564af7fc2a01791183db684872311f48 (diff)
downloadmeson-arrayopt.tar.gz
String arguments can permit arbitrary string valuesarrayopt
by leaving out the choices keyword.
Diffstat (limited to 'mesonbuild/coredata.py')
-rw-r--r--mesonbuild/coredata.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 7fbf18ab0..376570c08 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -132,7 +132,7 @@ class UserStringArrayOption(UserOption):
def validate(self, value, user_input):
# User input is for options defined on the command line (via -D
- # options). Users should put their input in as a comma separated
+ # options). Users can put their input in as a comma separated
# string, but for defining options in meson_options.txt the format
# should match that of a combo
if not user_input:
@@ -144,7 +144,10 @@ class UserStringArrayOption(UserOption):
newvalue = value
else:
assert isinstance(value, str)
- newvalue = [v.strip() for v in value.split(',')]
+ if value.startswith('['):
+ newvalue = ast.literal_eval(value)
+ else:
+ newvalue = [v.strip() for v in value.split(',')]
if not isinstance(newvalue, list):
raise MesonException('"{0}" should be a string array, but it is not'.format(str(newvalue)))
for i in newvalue: