tools: Fix error in is_tool_available.
- Happened with bandit, but not pycodestyle. Not sure why.
This commit is contained in:
parent
5f45485479
commit
2dba7a6920
1 changed files with 4 additions and 1 deletions
|
|
@ -657,7 +657,10 @@ def splitext(path):
|
|||
@functools.lru_cache()
|
||||
def is_tool_available(tool):
|
||||
if (hasattr(tool, "command") and tool.command.startswith(f"{PYTHON_EXECUTABLE} -m ")):
|
||||
try:
|
||||
return importlib.util.find_spec(tool.command.split()[2]) is not None
|
||||
except ModuleNotFoundError:
|
||||
return False
|
||||
try:
|
||||
return all(shutil.which(executable) for executable in tool.executables)
|
||||
except AttributeError:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue