diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-04-09 21:57:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-09 21:57:46 +0300 |
commit | 1652dccea2c1c4729f74ae66c7af5e3decf3dc5b (patch) | |
tree | 70e8aec9bcc1037ea406ab422c196cbbd792aaba /mesonbuild/mesonlib.py | |
parent | 0e8eba7f644571ea0beb40334d2a3d0b150ac4ef (diff) | |
parent | aa3480dabaaf8fe164ae9fa5115cc092277245f5 (diff) | |
download | meson-1652dccea2c1c4729f74ae66c7af5e3decf3dc5b.zip meson-1652dccea2c1c4729f74ae66c7af5e3decf3dc5b.tar.gz meson-1652dccea2c1c4729f74ae66c7af5e3decf3dc5b.tar.bz2 |
Merge pull request #1469 from centricular/install-secondary-outputs
Support multiple install dirs for built/custom targets
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index a2ab484..5377d8e 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -467,25 +467,22 @@ def replace_if_different(dst, dst_tmp): else: os.unlink(dst_tmp) -def stringintlistify(item): - if isinstance(item, (str, int)): +def typeslistify(item, types): + ''' + Ensure that type(@item) is one of @types or a + list of items all of which are of type @types + ''' + if isinstance(item, types): item = [item] if not isinstance(item, list): - raise MesonException('Item must be a list, a string, or an int') + raise MesonException('Item must be a list or one of {!r}'.format(types)) for i in item: - if not isinstance(i, (str, int, type(None))): - raise MesonException('List item must be a string or an int') + if i is not None and not isinstance(i, types): + raise MesonException('List item must be one of {!r}'.format(types)) return item def stringlistify(item): - if isinstance(item, str): - item = [item] - if not isinstance(item, list): - raise MesonException('Item is not a list') - for i in item: - if not isinstance(i, str): - raise MesonException('List item not a string.') - return item + return typeslistify(item, str) def expand_arguments(args): expended_args = [] |