1
0
forked from VimPlug/jedi

Replace distutils.spawn.find_executable with shutil.which

The distutils.spawn.find_executable function is not available on stock system
Python 3 in recent Debian-based distributions. Since shutil.which is a better
alternative but not available on Python 2.7, we include a copy of that function
and use it in place of find_executable.
This commit is contained in:
micbou
2018-06-04 23:42:50 +02:00
committed by Dave Halter
parent 5dab97a303
commit 70c2fce9c2
2 changed files with 66 additions and 5 deletions

View File

@@ -9,11 +9,8 @@ import hashlib
import filecmp
from subprocess import PIPE
from collections import namedtuple
# When dropping Python 2.7 support we should consider switching to
# `shutil.which`.
from distutils.spawn import find_executable
from jedi._compatibility import GeneralizedPopen
from jedi._compatibility import GeneralizedPopen, which
from jedi.cache import memoize_method, time_cache
from jedi.evaluate.compiled.subprocess import get_subprocess, \
EvaluatorSameProcess, EvaluatorSubprocess
@@ -276,7 +273,7 @@ def get_system_environment(version):
:raises: :exc:`.InvalidPythonEnvironment`
:returns: :class:`Environment`
"""
exe = find_executable('python' + version)
exe = which('python' + version)
if exe:
if exe == sys.executable:
return SameEnvironment()