aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-06-13 00:45:15 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-06-14 01:04:55 -0400
commitaa13c46822611f615429f3f05556fc29c7e1d505 (patch)
treed59b9645972ea0f46d00b0eb532b38140b4806cb /mesonbuild/compilers
parentc503c757f1afa4677d98901ce3fc1e509c01aeeb (diff)
downloadmeson-aa13c46822611f615429f3f05556fc29c7e1d505.zip
meson-aa13c46822611f615429f3f05556fc29c7e1d505.tar.gz
meson-aa13c46822611f615429f3f05556fc29c7e1d505.tar.bz2
WIP: refactor loggable popen calls for consistency
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/compilers.py7
-rw-r--r--mesonbuild/compilers/detect.py9
2 files changed, 4 insertions, 12 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 5f6fa08..76f9e0e 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -26,7 +26,7 @@ from .. import mesonlib
from ..mesonlib import (
HoldableObject,
EnvironmentException, MesonException,
- Popen_safe, LibType, TemporaryDirectoryWinProof, OptionKey,
+ Popen_safe_logged, LibType, TemporaryDirectoryWinProof, OptionKey,
)
from ..arglist import CompilerArgs
@@ -855,15 +855,12 @@ 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('Command line: ', ' '.join(command_list), '\n')
mlog.debug('Code:\n', contents)
os_env = os.environ.copy()
os_env['LC_ALL'] = 'C'
if no_ccache:
os_env['CCACHE_DISABLE'] = '1'
- p, stdo, stde = Popen_safe(command_list, cwd=tmpdirname, env=os_env)
- mlog.debug('Compiler stdout:\n', stdo)
- mlog.debug('Compiler stderr:\n', stde)
+ p, stdo, stde = Popen_safe_logged(command_list, msg='Command line', cwd=tmpdirname, env=os_env)
result = CompileResult(stdo, stde, command_list, p.returncode, input_name=srcname)
if want_output:
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index c6d6ae3..f950331 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -15,7 +15,7 @@ from __future__ import annotations
from ..mesonlib import (
MesonException, EnvironmentException, MachineChoice, join_args,
- search_version, is_windows, Popen_safe, windows_proof_rm,
+ search_version, is_windows, Popen_safe, Popen_safe_logged, windows_proof_rm,
)
from ..envconfig import BinaryTable
from .. import mlog
@@ -327,12 +327,7 @@ def _detect_c_or_cpp_compiler(env: 'Environment', lang: str, for_machine: Machin
cmd = compiler + [arg]
try:
- mlog.debug('-----')
- mlog.debug(f'Detecting compiler via: {join_args(cmd)}')
- p, out, err = Popen_safe(cmd)
- mlog.debug(f'compiler returned {p}')
- mlog.debug(f'compiler stdout:\n{out}')
- mlog.debug(f'compiler stderr:\n{err}')
+ p, out, err = Popen_safe_logged(cmd, msg='Detecting compiler via')
except OSError as e:
popen_exceptions[join_args(cmd)] = e
continue