diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-10-13 14:33:57 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-11-09 10:50:59 +0100 |
commit | c2f1d91b8ac8699e48283b4d36c0d1f2510b7586 (patch) | |
tree | e53a284089f711c709e5aba9bccca27a64a61009 /mesonbuild/mesonlib/universal.py | |
parent | da522efc937c4747dbc1a43f7cc5c691bde685aa (diff) | |
download | meson-c2f1d91b8ac8699e48283b4d36c0d1f2510b7586.zip meson-c2f1d91b8ac8699e48283b4d36c0d1f2510b7586.tar.gz meson-c2f1d91b8ac8699e48283b4d36c0d1f2510b7586.tar.bz2 |
depfixer: convert unused printing code to debugging functions
When installing with 'meson install --quiet' I'd get the following output:
This file does not have an rpath.
This file does not have a runpath.
(It turns out that of the couple hundred of binaries that are installed,
this message was generated for /usr/lib/systemd/boot/efi/linuxx64.elf.stub.)
There doesn't seem to be any good reason for this output by default. But those
functions can still be used for debugging. Under a debugger, returning the
string is just as useful as printing it, but more flexible. So let's suppress
printing of anything by default, but keep the extractor functions.
The code was somewhat inconsistent wrt. to when .decode() was done. But it
seems that we'll get can expect a decodable text string in all cases, so
just call .decode() everywhere, because it's nicer to print decoded strings.
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 |