Fix exception in 'test cases/failing/55 wrong shared crate type' when rustc is missing

Fix exception handling of missing rustc, by making it look like the other
compiler detectors

Traceback (most recent call last):
  File "/wip/meson/mesonbuild/environment.py", line 699, in detect_rust_compiler
    p, out = Popen_safe(compiler + ['--version'])[0:2]
[...]
FileNotFoundError: [Errno 2] No such file or directory: 'rustc': 'rustc'

During handling of the above exception, another exception occurred:

[...]
  File "/wip/meson/mesonbuild/environment.py", line 701, in detect_rust_compiler
    popen_exceptions[compiler] = e
TypeError: unhashable type: 'list'
pull/2863/head
Jon Turney 7 years ago
parent 56286fd2b8
commit f37692bedb
  1. 5
      mesonbuild/environment.py

@ -695,10 +695,11 @@ class Environment:
for compiler in compilers: for compiler in compilers:
if isinstance(compiler, str): if isinstance(compiler, str):
compiler = [compiler] compiler = [compiler]
arg = ['--version']
try: try:
p, out = Popen_safe(compiler + ['--version'])[0:2] p, out = Popen_safe(compiler + arg)[0:2]
except OSError as e: except OSError as e:
popen_exceptions[compiler] = e popen_exceptions[' '.join(compiler + arg)] = e
continue continue
version = search_version(out) version = search_version(out)

Loading…
Cancel
Save