From b1358ef61f12f86b900bfa8071ae24c8d3468845 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 6 Nov 2023 08:00:43 -0500 Subject: [PATCH] compilers: Do not dump File content in log for compiler checks. When doing a compiler check with a File object, there is no need to dump the file into logs, we can just print the path. The file could potentially be big. --- mesonbuild/compilers/compilers.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index faa147ad7..6b598622c 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -789,14 +789,10 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): ofile.write(code) # ccache would result in a cache miss no_ccache = True - contents = code + code_debug = f'Code:\n{code}' else: srcname = code.fname - if not is_object(code.fname): - with open(code.fname, encoding='utf-8') as f: - contents = f.read() - else: - contents = '' + code_debug = f'Source file: {srcname}' # Construct the compiler command-line commands = self.compiler_args() @@ -817,7 +813,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): command_list = self.get_exelist(ccache=not no_ccache) + commands.to_native() mlog.debug('Running compile:') mlog.debug('Working directory: ', tmpdirname) - mlog.debug('Code:\n', contents) + mlog.debug(code_debug) os_env = os.environ.copy() os_env['LC_ALL'] = 'C' if no_ccache: