compilers: add logging for non c_or_cpp language detection

pull/11874/head
Eli Schwartz 1 year ago
parent aa13c46822
commit a6bf2c1e2c
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 22
      mesonbuild/compilers/detect.py

@ -209,7 +209,7 @@ def detect_static_linker(env: 'Environment', compiler: Compiler) -> StaticLinker
else: else:
arg = '--version' arg = '--version'
try: try:
p, out, err = Popen_safe(linker + [arg]) p, out, err = Popen_safe_logged(linker + [arg], msg='Detecting linker via')
except OSError as e: except OSError as e:
popen_exceptions[join_args(linker + [arg])] = e popen_exceptions[join_args(linker + [arg])] = e
continue continue
@ -626,7 +626,7 @@ def detect_cuda_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp
for compiler in compilers: for compiler in compilers:
arg = '--version' arg = '--version'
try: try:
p, out, err = Popen_safe(compiler + [arg]) p, out, err = Popen_safe_logged(compiler + [arg], msg='Detecting compiler via')
except OSError as e: except OSError as e:
popen_exceptions[join_args(compiler + [arg])] = e popen_exceptions[join_args(compiler + [arg])] = e
continue continue
@ -664,7 +664,7 @@ def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> C
for compiler in compilers: for compiler in compilers:
for arg in ['--version', '-V']: for arg in ['--version', '-V']:
try: try:
p, out, err = Popen_safe(compiler + [arg]) p, out, err = Popen_safe_logged(compiler + [arg], msg='Detecting compiler via')
except OSError as e: except OSError as e:
popen_exceptions[join_args(compiler + [arg])] = e popen_exceptions[join_args(compiler + [arg])] = e
continue continue
@ -827,7 +827,7 @@ def _detect_objc_or_objcpp_compiler(env: 'Environment', lang: str, for_machine:
for compiler in compilers: for compiler in compilers:
arg = ['--version'] arg = ['--version']
try: try:
p, out, err = Popen_safe(compiler + arg) p, out, err = Popen_safe_logged(compiler + arg, msg='Detecting compiler via')
except OSError as e: except OSError as e:
popen_exceptions[join_args(compiler + arg)] = e popen_exceptions[join_args(compiler + arg)] = e
continue continue
@ -877,7 +877,7 @@ def detect_java_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp
exelist = [defaults['java'][0]] exelist = [defaults['java'][0]]
try: try:
p, out, err = Popen_safe(exelist + ['-version']) p, out, err = Popen_safe_logged(exelist + ['-version'], msg='Detecting compiler via')
except OSError: except OSError:
raise EnvironmentException('Could not execute Java compiler: {}'.format(join_args(exelist))) raise EnvironmentException('Could not execute Java compiler: {}'.format(join_args(exelist)))
if 'javac' in out or 'javac' in err: if 'javac' in out or 'javac' in err:
@ -898,7 +898,7 @@ def detect_cs_compiler(env: 'Environment', for_machine: MachineChoice) -> Compil
info = env.machines[for_machine] info = env.machines[for_machine]
for comp in compilers: for comp in compilers:
try: try:
p, out, err = Popen_safe(comp + ['--version']) p, out, err = Popen_safe_logged(comp + ['--version'], msg='Detecting compiler via')
except OSError as e: except OSError as e:
popen_exceptions[join_args(comp + ['--version'])] = e popen_exceptions[join_args(comp + ['--version'])] = e
continue continue
@ -927,7 +927,7 @@ def detect_cython_compiler(env: 'Environment', for_machine: MachineChoice) -> Co
popen_exceptions: T.Dict[str, Exception] = {} popen_exceptions: T.Dict[str, Exception] = {}
for comp in compilers: for comp in compilers:
try: try:
err = Popen_safe(comp + ['-V'])[2] err = Popen_safe_logged(comp + ['-V'], msg='Detecting compiler via')[2]
except OSError as e: except OSError as e:
popen_exceptions[join_args(comp + ['-V'])] = e popen_exceptions[join_args(comp + ['-V'])] = e
continue continue
@ -950,7 +950,7 @@ def detect_vala_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp
exelist = [defaults['vala'][0]] exelist = [defaults['vala'][0]]
try: try:
p, out = Popen_safe(exelist + ['--version'])[0:2] p, out = Popen_safe_logged(exelist + ['--version'], msg='Detecting compiler via')[0:2]
except OSError: except OSError:
raise EnvironmentException('Could not execute Vala compiler: {}'.format(join_args(exelist))) raise EnvironmentException('Could not execute Vala compiler: {}'.format(join_args(exelist)))
version = search_version(out) version = search_version(out)
@ -975,7 +975,7 @@ def detect_rust_compiler(env: 'Environment', for_machine: MachineChoice) -> Rust
for compiler in compilers: for compiler in compilers:
arg = ['--version'] arg = ['--version']
try: try:
out = Popen_safe(compiler + arg)[1] out = Popen_safe_logged(compiler + arg, msg='Detecting compiler via')[1]
except OSError as e: except OSError as e:
popen_exceptions[join_args(compiler + arg)] = e popen_exceptions[join_args(compiler + arg)] = e
continue continue
@ -1198,7 +1198,7 @@ def detect_swift_compiler(env: 'Environment', for_machine: MachineChoice) -> Com
exelist = [defaults['swift'][0]] exelist = [defaults['swift'][0]]
try: try:
p, _, err = Popen_safe(exelist + ['-v']) p, _, err = Popen_safe_logged(exelist + ['-v'], msg='Detecting compiler via')
except OSError: except OSError:
raise EnvironmentException('Could not execute Swift compiler: {}'.format(join_args(exelist))) raise EnvironmentException('Could not execute Swift compiler: {}'.format(join_args(exelist)))
version = search_version(err) version = search_version(err)
@ -1234,7 +1234,7 @@ def detect_nasm_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp
default_path = os.path.join(os.environ['ProgramFiles'], 'NASM') default_path = os.path.join(os.environ['ProgramFiles'], 'NASM')
comp[0] = shutil.which(comp[0], path=default_path) or comp[0] comp[0] = shutil.which(comp[0], path=default_path) or comp[0]
try: try:
output = Popen_safe(comp + ['--version'])[1] output = Popen_safe_logged(comp + ['--version'], msg='Detecting compiler via')[1]
except OSError as e: except OSError as e:
popen_exceptions[' '.join(comp + ['--version'])] = e popen_exceptions[' '.join(comp + ['--version'])] = e
continue continue

Loading…
Cancel
Save