1
0
forked from VimPlug/jedi

Use sys path mostly from project and move some sys path stuff around.

This commit is contained in:
Dave Halter
2017-10-05 10:06:28 +02:00
parent 383f749026
commit 51d2ffb078
7 changed files with 77 additions and 67 deletions
+19 -5
View File
@@ -1,7 +1,8 @@
import os
import sys
from jedi.evaluate.sys_path import get_venv_path
from jedi.evaluate.sys_path import get_venv_path, detect_additional_paths
from jedi.cache import underscore_memoization
class Project(object):
@@ -14,11 +15,24 @@ class Project(object):
if sys_path is None:
sys_path = sys.path
sys_path = list(sys_path)
base_sys_path = list(sys_path)
try:
sys_path.remove('')
base_sys_path.remove('')
except ValueError:
pass
self.sys_path = sys_path
self._base_sys_path = base_sys_path
def add_script_path(self, script_path):
self._script_path = script_path
def add_evaluator(self, evaluator):
self._evaluator = evaluator
@property
@underscore_memoization
def sys_path(self):
if self._script_path is None:
return self._base_sys_path
return self._base_sys_path + detect_additional_paths(self._evaluator, self._script_path)