Merge pull request #53712 from liff/bear/fix-wrapper-detection
bear: fix wrapper detection patch by checking result of find_executable
This commit is contained in:
commit
fdd75fc6f1
@ -1,6 +1,6 @@
|
|||||||
--- Bear-2.3.11-src/bear/main.py.in 1970-01-01 01:00:01.000000000 +0100
|
--- a/bear/main.py.in
|
||||||
+++ Bear-2.3.11-src-patch/bear/main.py.in 1970-01-01 01:00:01.000000000 +0100
|
+++ b/bear/main.py.in
|
||||||
@@ -49,6 +49,7 @@
|
@@ -49,6 +49,7 @@ import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import contextlib
|
import contextlib
|
||||||
import logging
|
import logging
|
||||||
@ -8,16 +8,20 @@
|
|||||||
|
|
||||||
# Map of ignored compiler option for the creation of a compilation database.
|
# Map of ignored compiler option for the creation of a compilation database.
|
||||||
# This map is used in _split_command method, which classifies the parameters
|
# This map is used in _split_command method, which classifies the parameters
|
||||||
@@ -540,7 +541,11 @@
|
@@ -569,7 +570,15 @@ class Compilation:
|
||||||
any(pattern.match(cmd) for pattern in COMPILER_PATTERNS_CXX)
|
(compiler, language, rest of the command) otherwise """
|
||||||
|
|
||||||
if command: # not empty list will allow to index '0' and '1:'
|
if command: # not empty list will allow to index '0' and '1:'
|
||||||
- executable = os.path.basename(command[0]) # type: str
|
- executable = os.path.basename(command[0]) # type: str
|
||||||
+ absolute_executable = os.path.realpath(find_executable(command[0]))
|
+ executable_file = find_executable(command[0])
|
||||||
|
+ if executable_file:
|
||||||
|
+ absolute_executable = os.path.realpath(executable_file)
|
||||||
|
+ # Ignore Nix wrappers.
|
||||||
+ if 'wrapper' in absolute_executable:
|
+ if 'wrapper' in absolute_executable:
|
||||||
+ return None
|
+ return None
|
||||||
+
|
+ executable = os.path.basename(absolute_executable)
|
||||||
+ executable = os.path.basename(absolute_executable) # type: str
|
+ else:
|
||||||
|
+ executable = os.path.basename(command[0])
|
||||||
parameters = command[1:] # type: List[str]
|
parameters = command[1:] # type: List[str]
|
||||||
# 'wrapper' 'parameters' and
|
# 'wrapper' 'parameters' and
|
||||||
# 'wrapper' 'compiler' 'parameters' are valid.
|
# 'wrapper' 'compiler' 'parameters' are valid.
|
Loading…
Reference in New Issue
Block a user