diff options
Diffstat (limited to 'mesonbuild/mesonlib/universal.py')
-rw-r--r-- | mesonbuild/mesonlib/universal.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index a53892c..4655810 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -87,6 +87,7 @@ __all__ = [ 'exe_exists', 'expand_arguments', 'extract_as_list', + 'generate_list', 'get_compiler_for_source', 'get_filenames_templates_dict', 'get_library_dirs', @@ -1918,6 +1919,14 @@ def run_once(func: T.Callable[..., _T]) -> T.Callable[..., _T]: return wrapper +def generate_list(func: T.Callable[..., T.Generator[_T, None, None]]) -> T.Callable[..., T.List[_T]]: + @wraps(func) + def wrapper(*args: T.Any, **kwargs: T.Any) -> T.List[_T]: + return list(func(*args, **kwargs)) + + return wrapper + + class OptionOverrideProxy(collections.abc.MutableMapping): '''Mimic an option list but transparently override selected option |