forked from VimPlug/jedi
Make the subprocesses work and return the right sys paths for the different versions
This commit is contained in:
@@ -7,6 +7,7 @@ goals:
|
||||
2. Make it possible to handle different Python versions as well as virtualenvs.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import weakref
|
||||
@@ -20,6 +21,8 @@ _PICKLE_PROTOCOL = 2
|
||||
|
||||
_subprocesses = {}
|
||||
|
||||
_MAIN_PATH = os.path.join(os.path.dirname(__file__), '__main__.py')
|
||||
|
||||
|
||||
def get_subprocess(executable):
|
||||
try:
|
||||
@@ -88,8 +91,12 @@ class _Subprocess(object):
|
||||
|
||||
class _CompiledSubprocess(_Subprocess):
|
||||
def __init__(self, executable):
|
||||
parso_path = sys.modules['parso'].__file__
|
||||
super(_CompiledSubprocess, self).__init__(
|
||||
(executable, '-m', 'jedi.evaluate.compiled.subprocess')
|
||||
(executable,
|
||||
_MAIN_PATH,
|
||||
os.path.dirname(os.path.dirname(parso_path))
|
||||
)
|
||||
)
|
||||
|
||||
def run(self, evaluator, function, *args, **kwargs):
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Get the path to jedi.
|
||||
_d = os.path.dirname
|
||||
_jedi_path = _d(_d(_d(_d(_d(__file__)))))
|
||||
_parso_path = sys.argv[1]
|
||||
|
||||
# This is kind of stupid. We actually don't want to modify the sys path but
|
||||
# simply import something from a specific location.
|
||||
sys.path[0:0] = [_jedi_path, _parso_path]
|
||||
from jedi.evaluate.compiled import subprocess
|
||||
sys.path[0:2] = []
|
||||
|
||||
subprocess.Listener().listen()
|
||||
|
||||
Reference in New Issue
Block a user