2019-01-09 21:00:16 +00:00
|
|
|
--- a/bear/main.py.in
|
|
|
|
+++ b/bear/main.py.in
|
|
|
|
@@ -49,6 +49,7 @@ import tempfile
|
2016-11-03 14:27:03 +00:00
|
|
|
import shutil
|
|
|
|
import contextlib
|
|
|
|
import logging
|
|
|
|
+from distutils.spawn import find_executable
|
|
|
|
|
2018-02-06 05:13:54 +00:00
|
|
|
# Map of ignored compiler option for the creation of a compilation database.
|
|
|
|
# This map is used in _split_command method, which classifies the parameters
|
2019-01-09 21:00:16 +00:00
|
|
|
@@ -569,7 +570,15 @@ class Compilation:
|
|
|
|
(compiler, language, rest of the command) otherwise """
|
2016-11-03 14:27:03 +00:00
|
|
|
|
2018-02-06 05:13:54 +00:00
|
|
|
if command: # not empty list will allow to index '0' and '1:'
|
|
|
|
- executable = os.path.basename(command[0]) # type: str
|
2019-01-09 21:00:16 +00:00
|
|
|
+ executable_file = find_executable(command[0])
|
|
|
|
+ if executable_file:
|
|
|
|
+ absolute_executable = os.path.realpath(executable_file)
|
|
|
|
+ # Ignore Nix wrappers.
|
|
|
|
+ if 'wrapper' in absolute_executable:
|
|
|
|
+ return None
|
|
|
|
+ executable = os.path.basename(absolute_executable)
|
|
|
|
+ else:
|
|
|
|
+ executable = os.path.basename(command[0])
|
2018-02-06 05:13:54 +00:00
|
|
|
parameters = command[1:] # type: List[str]
|
|
|
|
# 'wrapper' 'parameters' and
|
|
|
|
# 'wrapper' 'compiler' 'parameters' are valid.
|