diff options
author | Aleksey Gurtovoy <agurtovoy@acm.org> | 2019-10-04 18:34:02 -0500 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-11-05 22:17:44 +0200 |
commit | f56ef583d3c8ecda7725ca04b48011c9081a7349 (patch) | |
tree | dca107fce3c6cafa32e575406020be827b6197fa /mesonbuild/mesonlib.py | |
parent | 11f1adb7ddc800b8c016f3ee40e979a377ba9c01 (diff) | |
download | meson-f56ef583d3c8ecda7725ca04b48011c9081a7349.zip meson-f56ef583d3c8ecda7725ca04b48011c9081a7349.tar.gz meson-f56ef583d3c8ecda7725ca04b48011c9081a7349.tar.bz2 |
dependency('cuda')
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index db7ac48..d289ff2 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -21,6 +21,7 @@ import platform, subprocess, operator, os, shlex, shutil, re import collections from enum import Enum from functools import lru_cache, update_wrapper +from itertools import tee, filterfalse import typing import uuid @@ -1051,6 +1052,12 @@ def expand_arguments(args): return None return expended_args +def partition(pred, iterable): + 'Use a predicate to partition entries into false entries and true entries' + # partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 + t1, t2 = tee(iterable) + return filterfalse(pred, t1), filter(pred, t2) + def Popen_safe(args: typing.List[str], write: typing.Optional[str] = None, stdout: typing.Union[typing.BinaryIO, int] = subprocess.PIPE, stderr: typing.Union[typing.BinaryIO, int] = subprocess.PIPE, |