aboutsummaryrefslogtreecommitdiff
path: root/mesonlib.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-10-12 22:22:13 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-10-12 22:22:13 +0300
commit0d56955e9cda7993ef07894fb58bb90ba5b463e6 (patch)
tree96cd4a23c0cf252db4c8e86106643ef3131a39a2 /mesonlib.py
parent5cdad45b903c6300935fad55effa1cef75512281 (diff)
downloadmeson-0d56955e9cda7993ef07894fb58bb90ba5b463e6.zip
meson-0d56955e9cda7993ef07894fb58bb90ba5b463e6.tar.gz
meson-0d56955e9cda7993ef07894fb58bb90ba5b463e6.tar.bz2
Created a stringarray option type and added Windows system libs option that uses it.
Diffstat (limited to 'mesonlib.py')
-rw-r--r--mesonlib.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/mesonlib.py b/mesonlib.py
index 0e31ef1..0c7c308 100644
--- a/mesonlib.py
+++ b/mesonlib.py
@@ -314,3 +314,20 @@ class UserComboOption(UserOption):
optionsstring = ', '.join(['"%s"' % (item,) for item in self.choices])
raise MesonException('Value "%s" for combo option "%s" is not one of the choices. Possible choices are: %s.' % (newvalue, self.name, optionsstring))
self.value = newvalue
+
+class UserStringArrayOption(UserOption):
+ def __init__(self, name, description, value):
+ super().__init__(name, description)
+ self.set_value(value)
+
+ def set_value(self, newvalue):
+ if isinstance(newvalue, str):
+ if not newvalue.startswith('['):
+ raise MesonException('Valuestring does not define an array: ' + newvalue)
+ newvalue = eval(newvalue, {}, {}) # Yes, it is unsafe.
+ if not isinstance(newvalue, list):
+ raise MesonException('String array value is not an array.')
+ for i in newvalue:
+ if not isinstance(i, str):
+ raise MesonException('String array element not a string.')
+ self.value = newvalue