diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2018-05-13 10:36:58 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-06-06 20:02:37 +0000 |
commit | 64bfc6cf7b6439578191e75cbc05bb96de1c70e2 (patch) | |
tree | 687d90b71cbcec5bba013a41aa7d0c9231a19f82 | |
parent | fa72cd7173c0e2798d622052ae3fcee2ad947c0b (diff) | |
download | meson-64bfc6cf7b6439578191e75cbc05bb96de1c70e2.zip meson-64bfc6cf7b6439578191e75cbc05bb96de1c70e2.tar.gz meson-64bfc6cf7b6439578191e75cbc05bb96de1c70e2.tar.bz2 |
UserArrayOption: Add support for splitting on space instead of coma
-rw-r--r-- | mesonbuild/coredata.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index f3313f3..93a3d2f 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -138,8 +138,9 @@ class UserComboOption(UserOption): return value class UserArrayOption(UserOption): - def __init__(self, name, description, value, **kwargs): + def __init__(self, name, description, value, shlex_split=False, **kwargs): super().__init__(name, description, kwargs.get('choices', []), yielding=kwargs.get('yielding', None)) + self.shlex_split = shlex_split self.value = self.validate_value(value, user_input=False) def validate_value(self, value, user_input=True): @@ -159,7 +160,10 @@ class UserArrayOption(UserOption): if value.startswith('['): newvalue = ast.literal_eval(value) else: - newvalue = [v.strip() for v in value.split(',')] + if self.shlex_split: + newvalue = shlex.split(value) + else: + newvalue = [v.strip() for v in value.split(',')] if len(set(newvalue)) != len(newvalue): mlog.log(mlog.red('DEPRECATION:'), '''Duplicated values in an array type is deprecated. This will become a hard error in the future.''') |